This series fixes a bug in virSocketAddrFormatWithPrefix() where an
uninitialized variable was being used when masked=false, adds comprehensive
test coverage to prevent regressions, and includes a minor code cleanup for
consistency.
The bug was discovered in the virSocketAddrFormatWithPrefix() function,
which is used to format IP addresses with prefix notation (e.g., "1.2.3.4/24").
When the 'masked' parameter was false (meaning the caller wanted to format
the original address with a prefix, not the network address), the 'network'
variable was left uninitialized, leading to undefined behavior.
Julio Faracco (3):
util: Fix uninitialized variable in virSocketAddrFormatWithPrefix
tests: Add tests for virSocketAddrFormatWithPrefix
util: Standardize macro usage to check socket family
src/util/virsocketaddr.c | 14 +++++---
tests/sockettest.c | 70 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 5 deletions(-)
--
2.52.0