The return value of snprintf should be always nonnegative, so it should
be safe to cast it to a size_t before comparing it to a sizeof().
This commit is contained in:
parent
47e9e6a168
commit
8015edeebb
@ -234,7 +234,7 @@ newfile(void)
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if (snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix,
|
if ((size_t)snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix,
|
||||||
(int)sufflen, nfiles) >= sizeof(currfile)) {
|
(int)sufflen, nfiles) >= sizeof(currfile)) {
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user