Replace various sprintf calls with snprintf calls

This commit is contained in:
Tim Angus committed 2025-07-13 13:29:50 +01:00
1 parent ab18167a09
commit aea99aa3a3
4 files changed
+9 -9

No files matched your search

+5 -5
View File
@@ -88,7 +88,7 @@ void ExpandWildcards( int *argc, char ***argv )
do
{
sprintf (filename, "%s%s", filebase, fileinfo.name);
snprintf (filename, sizeof(filename), "%s%s", filebase, fileinfo.name);
ex_argv[ex_argc++] = copystring (filename);
} while (_findnext( handle, &fileinfo ) != -1);
@@ -126,7 +126,7 @@ void Error( const char *error, ... )
vsprintf (text, error,argptr);
va_end (argptr);
sprintf (text2, "%s\nGetLastError() = %i", text, err);
snprintf (text2, sizeof(text2), "%s\nGetLastError() = %i", text, err);
MessageBox(NULL, text2, "Error", 0 /* MB_OK */ );
exit (1);
@@ -318,7 +318,7 @@ char *ExpandPath (const char *path)
strcpy( full, path );
return full;
}
sprintf (full, "%s%s", qdir, path);
snprintf (full, sizeof(full), "%s%s", qdir, path);
return full;
}
@@ -331,7 +331,7 @@ char *ExpandGamePath (const char *path)
strcpy( full, path );
return full;
}
sprintf (full, "%s%s", gamedir, path);
snprintf (full, sizeof(full), "%s%s", gamedir, path);
return full;
}
@@ -344,7 +344,7 @@ char *ExpandPathAndArchive (const char *path)
if (archive)
{
sprintf (archivename, "%s/%s", archivedir, path);
snprintf (archivename, sizeof(archivename), "%s/%s", archivedir, path);
QCopyFile (expanded, archivename);
}
return expanded;