]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: virhostmem: do not use scanf without field limits
authorJán Tomko <jtomko@redhat.com>
Sun, 2 Aug 2020 21:03:10 +0000 (23:03 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 3 Aug 2020 13:19:29 +0000 (15:19 +0200)
commit0354bf2e065ba741608f5b4a87513bf305aafa68
treee3ed3f8917bfe738328b76c958030d6121ed71cd
parenta97594795a0460d216b41e4e04c2e8f6362a6c1f
util: virhostmem: do not use scanf without field limits

We use an array of size VIR_NODE_MEMORY_STATS_FIELD_LENGTH
to store the string read from sysfs, but pass unbound "%s"
to sscanf.

Make the array larger by one and simply stringify that
constant as the field width specifier.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/util/virhostmem.c