mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	stdlib: Fixed crash on SDL_snprintf("%s", NULL).
Like other C runtimes, it should probably produce the string "(null)". This bug probably only affected Windows, as most platforms use their standard C runtime's snprintf().
This commit is contained in:
		| @@ -1313,6 +1313,10 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str | |||||||
|     size_t length = 0; |     size_t length = 0; | ||||||
|     size_t slen; |     size_t slen; | ||||||
|  |  | ||||||
|  |     if (string == NULL) { | ||||||
|  |         string = "(null)"; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (info && info->width && (size_t)info->width > SDL_strlen(string)) { |     if (info && info->width && (size_t)info->width > SDL_strlen(string)) { | ||||||
|         char fill = info->pad_zeroes ? '0' : ' '; |         char fill = info->pad_zeroes ? '0' : ' '; | ||||||
|         size_t width = info->width - SDL_strlen(string); |         size_t width = info->width - SDL_strlen(string); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ryan C. Gordon
					Ryan C. Gordon