]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lslocks: check scanf() return code [coverity scan]
authorKarel Zak <kzak@redhat.com>
Mon, 29 Nov 2021 12:11:13 +0000 (13:11 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 29 Nov 2021 12:11:13 +0000 (13:11 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lslocks.c

index 9587aa5e053fcc0c425421cd7560cc6285a46e7c..9fa05c4e35941b19801fa5d8345fcfce125d7083 100644 (file)
@@ -224,7 +224,8 @@ static ino_t get_dev_inode(char *str, dev_t *dev)
        unsigned int maj = 0, min = 0;
        ino_t inum = 0;
 
-       sscanf(str, "%02x:%02x:%ju", &maj, &min, &inum);
+       if (sscanf(str, "%02x:%02x:%ju", &maj, &min, &inum) != 3)
+               errx(EXIT_FAILURE, _("failed to parse '%s'"), str);
 
        *dev = (dev_t) makedev(maj, min);
        return inum;