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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100821
@ -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