Cheyenne Wills 3d2e66c179 bucoord: Fix problems found by static analysis
Several static analysis tools have identified various problems:
 - printf conversion specifiers                   (cppcheck)
 - sscanf string overflows                        (cppcheck)
 - files left open from early exits               (infer)
 - dereference of NULL pointer                    (scan-build)
 - missing checks to ensure *alloc was successful (infer)
 - possible memory leaks                          (scan-build, cppcheck)

To resolve the above problems:
 - update printf conversion specifiers
 - update sscanf format strings to include the size of the buffer
 - close files before exiting
 - ensure pointers are non-NULL prior to use
 - add checks to ensure *alloc was successful before using the memory
 - fix possible memory leaks by freeing memory

This commit is a reorganization of commits developed by Pat Riehecky,
who ran the static analysis tools and developed the fixes.

Change-Id: I864b2c6be0c7dec1e93b49231ad7876d38c20435
Reviewed-on: https://gerrit.openafs.org/14677
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-11-18 14:02:28 -05:00
..