mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Use PyOS_snprintf instead of sprintf.
This commit is contained in:
		
							parent
							
								
									ef58b31991
								
							
						
					
					
						commit
						518ab1c02a
					
				
					 13 changed files with 45 additions and 39 deletions
				
			
		|  | @ -66,7 +66,8 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, | |||
| 	err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething); | ||||
| #endif | ||||
| 	if ( err ) { | ||||
| 		sprintf(buf, "%.200s: %.200s", pathname, PyMac_StrError(err)); | ||||
| 		PyOS_snprintf(buf, sizeof(buf), | ||||
| 			      "%.200s: %.200s", pathname, PyMac_StrError(err)); | ||||
| 		PyErr_SetString(PyExc_ImportError, buf); | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | @ -91,25 +92,26 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, | |||
| 		** the dynamic module was meant for a different Python. | ||||
| 		*/ | ||||
| 		if (errMessage[0] == 10 && strncmp((char *)errMessage+1, "PythonCore", 10) == 0 ) { | ||||
| 			sprintf(buf, "Dynamic module was built for %s version of MacPython", | ||||
| 				(err == cfragImportTooOldErr ? "a newer" : "an older")); | ||||
| 			PyOS_snprintf(buf, sizeof(buf), | ||||
| 		      "Dynamic module was built for %s version of MacPython", | ||||
| 		      (err == cfragImportTooOldErr ? "a newer" : "an older")); | ||||
| 			PyErr_SetString(PyExc_ImportError, buf); | ||||
| 			return NULL; | ||||
| 		} | ||||
| 	} | ||||
| 	if ( err ) { | ||||
| 		sprintf(buf, "%.*s: %.200s", | ||||
| 		PyOS_snprintf(buf, sizeof(buf), "%.*s: %.200s", | ||||
| 			errMessage[0], errMessage+1, | ||||
| 			PyMac_StrError(err)); | ||||
| 		PyErr_SetString(PyExc_ImportError, buf); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	/* Locate the address of the correct init function */ | ||||
| 	sprintf(funcname, "init%.200s", shortname); | ||||
| 	PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname); | ||||
| 	err = FindSymbol(connID, Pstring(funcname), &symAddr, &class); | ||||
| 	if ( err ) { | ||||
| 		sprintf(buf, "%s: %.200s", | ||||
| 			funcname, PyMac_StrError(err)); | ||||
| 		PyOS_snprintf(buf, sizeof(buf), "%s: %.200s", | ||||
| 			      funcname, PyMac_StrError(err)); | ||||
| 		PyErr_SetString(PyExc_ImportError, buf); | ||||
| 		return NULL; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Hylton
						Jeremy Hylton