]> err.no Git - util-linux/commitdiff
mount: fix has_* functions (CVE-2007-0822)
authorKarel Zak <kzak@redhat.com>
Mon, 14 May 2007 22:22:56 +0000 (00:22 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 17 May 2007 10:53:52 +0000 (12:53 +0200)
The functions have to check for NULL pointer.

Signed-off-by: Karel Zak <kzak@redhat.com>
mount/fstab.c

index c47f20d289698380d79811b561b2dc7cfefbe740..eee126e33ea9b5466391a80c58c41811152a9994 100644 (file)
@@ -293,8 +293,11 @@ has_label(const char *device, const char *label) {
        int ret;
 
        devlabel = fsprobe_get_label_by_devname(device);
+       if (!devlabel)
+               return 0;
+
        ret = !strcmp(label, devlabel);
-       /* free(devlabel); */
+       my_free(devlabel);
        return ret;
 }
 
@@ -304,8 +307,11 @@ has_uuid(const char *device, const char *uuid){
        int ret;
 
        devuuid = fsprobe_get_uuid_by_devname(device);
+       if (!devuuid)
+               return 0;
+
        ret = !strcmp(uuid, devuuid);
-       /* free(devuuid); */
+       my_free(devuuid);
        return ret;
 }