]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: check errno after strto..()
authorKarel Zak <kzak@redhat.com>
Mon, 21 Jun 2021 13:00:40 +0000 (15:00 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Jul 2021 09:33:27 +0000 (11:33 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-virt.c

index 60324b670967272757baa37fd39949bf744cfb0f..6b6deb8e81c121db330135967d112905d95b9cbf 100644 (file)
@@ -166,7 +166,10 @@ static int address_from_efi(size_t *address)
                        continue;
                *(addrp++) = '\0';
                if (strcmp(linebuf, "SMBIOS") == 0) {
+                       errno = 0;
                        *address = strtoul(addrp, NULL, 0);
+                       if (errno)
+                               continue;
                        ret = 0;
                        break;
                }