@@ -194,20 +194,20 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
194194 printf ( "load_add_on( %s ) failed" , fullpath );
195195 }
196196
197- switch ( the_id ) {
198- case B_ERROR :
199- sprintf ( buff , "BeOS: Failed to load %.200s" , fullpath );
200- break ;
201- default :
202- sprintf ( buff , "Unknown error loading %.200s" , fullpath );
203- break ;
204- }
197+ if ( the_id == B_ERROR )
198+ PyOS_snprintf ( buff , sizeof ( buff ),
199+ "BeOS: Failed to load %.200s" ,
200+ fullpath ) ;
201+ else
202+ PyOS_snprintf ( buff , sizeof ( buff ),
203+ "Unknown error loading %.200s" ,
204+ fullpath );
205205
206206 PyErr_SetString ( PyExc_ImportError , buff );
207207 return NULL ;
208208 }
209209
210- sprintf (funcname , "init%.200s" , shortname );
210+ PyOs_snprintf (funcname , sizeof ( funcname ) , "init%.200s" , shortname );
211211 if ( Py_VerboseFlag ) {
212212 printf ( "get_image_symbol( %s )\n" , funcname );
213213 }
@@ -224,16 +224,19 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
224224
225225 switch ( retval ) {
226226 case B_BAD_IMAGE_ID :
227- sprintf ( buff , "can't load init function for dynamic module: "
228- "Invalid image ID for %.180s" , fullpath );
227+ PyOS_snprintf ( buff , sizeof (buff ),
228+ "can't load init function for dynamic module: "
229+ "Invalid image ID for %.180s" , fullpath );
229230 break ;
230231 case B_BAD_INDEX :
231- sprintf ( buff , "can't load init function for dynamic module: "
232- "Bad index for %.180s" , funcname );
232+ PyOS_snprintf ( buff , sizeof (buff ),
233+ "can't load init function for dynamic module: "
234+ "Bad index for %.180s" , funcname );
233235 break ;
234236 default :
235- sprintf ( buff , "can't load init function for dynamic module: "
236- "Unknown error looking up %.180s" , funcname );
237+ PyOS_snprintf ( buff , sizeof (buf ),
238+ "can't load init function for dynamic module: "
239+ "Unknown error looking up %.180s" , funcname );
237240 break ;
238241 }
239242
0 commit comments