From: Karel Zak Date: Mon, 14 May 2007 22:22:56 +0000 (+0200) Subject: mount: fix has_* functions (CVE-2007-0822) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d392c8ed08f472eb5d49e8b99e430265041a2a60;p=util-linux mount: fix has_* functions (CVE-2007-0822) The functions have to check for NULL pointer. Signed-off-by: Karel Zak --- diff --git a/mount/fstab.c b/mount/fstab.c index c47f20d2..eee126e3 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -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; }