[PATCH 0/3] Fix uninitialized variable in virSocketAddrFormatWithPrefix

Julio Faracco posted 3 patches 1 day, 18 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20260105132904.25578-1-jcfaracco@gmail.com
src/util/virsocketaddr.c | 14 +++++---
tests/sockettest.c       | 70 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 5 deletions(-)
[PATCH 0/3] Fix uninitialized variable in virSocketAddrFormatWithPrefix
Posted by Julio Faracco 1 day, 18 hours ago
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