summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2005-11-14 17:39:00 +0000
committerrodrigc <rodrigc@FreeBSD.org>2005-11-14 17:39:00 +0000
commit342268504239239aa9f6dd35b970f8e38b164fc5 (patch)
treeace11aa6f8070d835a63daf57e55367bbcff6ac2 /sbin/mount
parent3e818c9936c54d23613e0b218f5e436df29318ee (diff)
downloadFreeBSD-src-342268504239239aa9f6dd35b970f8e38b164fc5.zip
FreeBSD-src-342268504239239aa9f6dd35b970f8e38b164fc5.tar.gz
In build_iovec(), if passed in len is -1, check to see if
val is NULL before doing strlen() to calculate new len. Submitted by: maxim
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/getmntopts.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index f0026f4..0c0e0fe 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/uio.h>
-#include <assert.h>
#include <err.h>
#include <errno.h>
#include <stdarg.h>
@@ -155,8 +154,12 @@ build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
(*iov)[i].iov_len = strlen(name) + 1;
i++;
(*iov)[i].iov_base = val;
- if (len == (size_t)-1)
- len = strlen(val) + 1;
+ if (len == (size_t)-1) {
+ if (val != NULL)
+ len = strlen(val) + 1;
+ else
+ len = 0;
+ }
(*iov)[i].iov_len = (int)len;
*iovlen = ++i;
}
OpenPOWER on IntegriCloud