diff options
-rw-r--r-- | lib/mangle.c | 2 | ||||
-rw-r--r-- | mount/mount_mntent.c | 3 | ||||
-rw-r--r-- | mount/umount.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/mangle.c b/lib/mangle.c index 99e8281e6..a5e157bc9 100644 --- a/lib/mangle.c +++ b/lib/mangle.c @@ -94,6 +94,8 @@ char *unmangle(const char *s, char **end) if (end) *end = e; + if (e == s) + return NULL; /* empty string */ buf = malloc(sz); if (!buf) diff --git a/mount/mount_mntent.c b/mount/mount_mntent.c index a1e34db02..d90def36b 100644 --- a/mount/mount_mntent.c +++ b/mount/mount_mntent.c @@ -128,6 +128,9 @@ my_getmntent (mntFILE *mfp) { me.mnt_opts = unmangle(s, &s); s = skip_spaces(s); + if (!me.mnt_fsname || !me.mnt_dir || !me.mnt_type) + goto err; + if (isdigit(*s)) { me.mnt_freq = atoi(s); while(isdigit(*s)) s++; diff --git a/mount/umount.c b/mount/umount.c index 8ef342a52..42671f465 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -608,7 +608,7 @@ umount_file (char *arg) { file); /* spec could be a file which is loop mounted */ - if (fs && !is_valid_loop(mc, fs)) + if (!fs || !is_valid_loop(mc, fs)) die (2, _("umount: %s mount disagrees with " "the fstab"), file); } |