mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
afsd: Avoid fscanf overflows when paring cacheinfo
clang-14 is producing the following diagnostic: afsd.c:581:44: error: 'fscanf' may overflow; destination buffer in argument 3 has size 1024, but the corresponding specifier may require size 1025 [-Werror,-Wfortify-source] fscanf(cachefd, "%1024[^:]:%1024[^:]:%d", tCacheMountDir, fscanf is being used to parse the contents of a file and the buffer sizes are hardcoded. Simply increase the size of the 2 buffers by 1. The diagnostic warning is changed to an error when configured with --enable-checking. Change-Id: Iefbc4e87242232531a266e876fe779476b42fb62 Reviewed-on: https://gerrit.openafs.org/14958 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
parent
ae70db6cde
commit
82c14b9a66
@ -559,7 +559,7 @@ ParseCacheInfoFile(void)
|
||||
FILE *cachefd; /*Descriptor for cache info file */
|
||||
int parseResult; /*Result of our fscanf() */
|
||||
int tCacheBlocks;
|
||||
char tCacheBaseDir[1024], *tbd, tCacheMountDir[1024], *tmd;
|
||||
char tCacheBaseDir[1025], *tbd, tCacheMountDir[1025], *tmd;
|
||||
|
||||
if (afsd_debug)
|
||||
printf("%s: Opening cache info file '%s'...\n", rn, fullpn_CacheInfo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user