libfstools: avoid segfault in find_mount_point
authorStijn Tintel <stijn@linux-ipv6.be>
Tue, 21 Dec 2021 17:37:03 +0000 (19:37 +0200)
committerStijn Tintel <stijn@linux-ipv6.be>
Sat, 5 Feb 2022 16:01:25 +0000 (18:01 +0200)
If block is NULL, find_mount_point will segfault when comparing it
against the device name found in /proc/self/mountinfo. Avoid this by
checking if block is NULL.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
libfstools/find.c

index cefdd23e26891bba28d038bcbcd1aed3c67bb337..1d91c515b42070406dee79a00dcc5f0575f8a0fd 100644 (file)
@@ -109,6 +109,9 @@ find_mount_point(char *block, int root_only)
        int rstat;
        unsigned int minor, major;
 
+       if (!block)
+               return NULL;
+
        if (!fp)
                return NULL;