From: Benjamin Kaduk Date: Sat, 2 Feb 2019 23:10:29 +0000 (-0600) Subject: dumpscan: appease gcc8 -Wformat-overflow X-Git-Tag: upstream/1.8.6_pre1^2~64 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c8762d82f5c387418b2ba749bbc15b7b7f40d749;p=packages%2Fo%2Fopenafs.git dumpscan: appease gcc8 -Wformat-overflow gcc does not benefit from our external knowledge that tm_year is tightly bounded, and thinks it could still be in the range [-2147481748, 2147483647], which would overflow our string buffer. The function in question does not have error handling in place, so rather than adding some or trying to assert the proper bounds, just use a slightly larger buffer for safety. Reviewed-on: https://gerrit.openafs.org/13472 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 8f03ff3bdd8eb9f4557cdb7054aee9b8ea432160) Change-Id: I05c8d998c6d40118a1bde923e346cddbdfa4192b Reviewed-on: https://gerrit.openafs.org/13741 Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/tools/dumpscan/afsdump_extract.c b/src/tools/dumpscan/afsdump_extract.c index 98f3a0c27..db0b2fab9 100644 --- a/src/tools/dumpscan/afsdump_extract.c +++ b/src/tools/dumpscan/afsdump_extract.c @@ -237,7 +237,7 @@ static char *month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", static char * datestr(time_t date) { - static char str[13]; + static char str[20]; time_t clock = time(0); struct tm *now, *then; int diff;