mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
qemuMonitorTextGetMemoryStats: decrease risk of false positive in parsing
The code erroneously searched the entire "reply" for a comma, when its intent was to search only that portion after "balloon: actual=" * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetMemoryStats): Search for "," only starting *after* the BALLOON_PREFIX string. Otherwise, we'd be more prone to false positives.
This commit is contained in:
parent
703c165188
commit
4697def66b
@ -593,7 +593,8 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
if ((offset = strstr(reply, BALLOON_PREFIX)) != NULL) {
|
||||
if ((offset = strchr(reply, ',')) != NULL) {
|
||||
offset += strlen(BALLOON_PREFIX);
|
||||
if ((offset = strchr(offset, ',')) != NULL) {
|
||||
ret = qemuMonitorParseExtraBalloonInfo(offset, stats, nr_stats);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user