[PATCH 07/10] mount: fix has_* functions (CVE-2007-0822)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The functions have to check for NULL pointer.

Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 mount/fstab.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/mount/fstab.c b/mount/fstab.c
index c47f20d..eee126e 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;
 }
 
-- 
1.5.0.6

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux