mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
ec5bcd1a0c
If the caller gives "/vicep" or "vicep" to volutil_GetPartitionID(), we'll strlcpy() an empty string into ascii[], setting ascii[0] to 0. Then we check the value of ascii[1], which is uninitialized. This doesn't result in any bad behavior, because we then immediately check the value of ascii[0] (which is 0), and return -1. But reading the uninitialized ascii[1] triggers errors in tools like valgrind, and is possibly fragile for future code changes. To avoid this, make sure ascii[] is initialized at the start of the function, and check if we have copied an empty string into ascii[]. While we are here, also add tests in volutil-t for invalid "vicep*" strings, to match the existing tests for invalid "/vicep*" strings. Change-Id: I724f893d4bb6421b955c1c89629ab9f277be98bc Reviewed-on: https://gerrit.openafs.org/15526 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com>