summaryrefslogtreecommitdiffstats
path: root/mount
diff options
context:
space:
mode:
authorKarel Zak2007-05-15 00:22:56 +0200
committerKarel Zak2007-05-17 12:53:52 +0200
commitd392c8ed08f472eb5d49e8b99e430265041a2a60 (patch)
tree753619c1b56bb67f5950f8494d020c06799f5cc8 /mount
parentmount: fsprobe: use blkid cache only when really necessary (diff)
downloadkernel-qcow2-util-linux-d392c8ed08f472eb5d49e8b99e430265041a2a60.tar.gz
kernel-qcow2-util-linux-d392c8ed08f472eb5d49e8b99e430265041a2a60.tar.xz
kernel-qcow2-util-linux-d392c8ed08f472eb5d49e8b99e430265041a2a60.zip
mount: fix has_* functions (CVE-2007-0822)
The functions have to check for NULL pointer. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r--mount/fstab.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mount/fstab.c b/mount/fstab.c
index c47f20d28..eee126e33 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;
}