From d392c8ed08f472eb5d49e8b99e430265041a2a60 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 15 May 2007 00:22:56 +0200 Subject: [PATCH] mount: fix has_* functions (CVE-2007-0822) The functions have to check for NULL pointer. Signed-off-by: Karel Zak --- mount/fstab.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; } -- 2.39.5