utils: Belt and braces to satisfy gcc
GCC was upset that it was theoretically possible for this format string to result in a buffer overrun. This is because it could not work out that `i` would never be negative. To silence the warning, we use %u and cast to unsigned during the formatting of the output filename. Signed-off-by: Daniel Silverstone <dsilvers@netsurf-browser.org>
This commit is contained in:
parent
9e448ebfcd
commit
74791c0229
|
@ -100,7 +100,7 @@ const char *filename_request(void)
|
|||
|
||||
i = i % 99;
|
||||
|
||||
snprintf(filename_buffer, sizeof(filename_buffer), "%s%.2i", dir->prefix, i);
|
||||
snprintf(filename_buffer, sizeof(filename_buffer), "%s%.2u", dir->prefix, (unsigned int)i);
|
||||
|
||||
return filename_buffer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue