mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
sanity check the strings to snprintf in open_file as we seem to somehow be
getting a stack overflow in there.
This commit is contained in:
parent
bb1adf63a9
commit
68f607de3c
1 changed files with 7 additions and 0 deletions
|
@ -525,6 +525,13 @@ open_file (searchpath_t *search, const char *filename, QFile **gzfile,
|
|||
return com_filesize;
|
||||
}
|
||||
} else {
|
||||
// sanity check the strings
|
||||
if (strnlen (search->filename, sizeof (netpath))
|
||||
+ strnlen (filename, sizeof (netpath)) + 2 > sizeof (netpath))
|
||||
Sys_Error ("open_file: search->filename and/or filename "
|
||||
"bogus: `%.*s' `%.*s'",
|
||||
(int) sizeof (netpath), search->filename,
|
||||
(int) sizeof (netpath), filename);
|
||||
// check a file in the directory tree
|
||||
snprintf (netpath, sizeof (netpath), "%s%s%s", search->filename,
|
||||
search->filename[0] ? "/" : "", filename);
|
||||
|
|
Loading…
Reference in a new issue