mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
nwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad
We allocate 16 bytes for IPv4 address and 55 bytes for interface key, therefore we should read up to 15/54 bytes and let the last byte reserved for terminating null byte in sscanf. https://bugzilla.redhat.com/show_bug.cgi?id=1226400
This commit is contained in:
parent
f88750b931
commit
152e315433
@ -1958,8 +1958,8 @@ virNWFilterSnoopLeaseFileLoad(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ln++;
|
ln++;
|
||||||
/* key len 55 = "VMUUID"+'-'+"MAC" */
|
/* key len 54 = "VMUUID"+'-'+"MAC" */
|
||||||
if (sscanf(line, "%u %55s %16s %16s", &ipl.timeout,
|
if (sscanf(line, "%u %54s %15s %15s", &ipl.timeout,
|
||||||
ifkey, ipstr, srvstr) < 4) {
|
ifkey, ipstr, srvstr) < 4) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("virNWFilterSnoopLeaseFileLoad lease file "
|
_("virNWFilterSnoopLeaseFileLoad lease file "
|
||||||
|
Loading…
Reference in New Issue
Block a user