ensure filename numeric is not truncated and hence cause output buffer overflow

This commit is contained in:
Vincent Sanders 2018-11-06 21:59:50 +00:00
parent 7264ff6f4d
commit 05ac430305
1 changed files with 3 additions and 1 deletions

View File

@ -96,7 +96,9 @@ const char *filename_request(void)
else
dir->high_used |= (1 << (i - 32));
sprintf(filename_buffer, "%s%.2i", dir->prefix, i);
i = i % 99;
snprintf(filename_buffer, sizeof(filename_buffer), "%s%.2i", dir->prefix, i);
return filename_buffer;
}