afsd: Avoid fscanf overflows when paring cacheinfo 58/14958/6
authorCheyenne Wills <cwills@sinenomine.net>
Wed, 11 May 2022 14:48:52 +0000 (08:48 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 2 Jun 2022 04:07:53 +0000 (00:07 -0400)
commit82c14b9a667174f044b7421e6e081ad323720a67
tree538c7ae1f2b3150a6189eeab21f81283cb5b3af3
parentae70db6cde5be5abd3bbbb26bd9af6fe68cc4b6b
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>
src/afsd/afsd.c