summaryrefslogtreecommitdiff
path: root/lib/libfuse
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-10-25 09:29:47 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-10-25 09:29:47 +0000
commitd3ddeeb366f1f76ecb30b26abc81bfb007f69833 (patch)
treecf5aa3c72859f9ac9c020ca25a6ce0684f6a6d8f /lib/libfuse
parent860ce566d388e383a0ad004238f6ea64ec9752fb (diff)
Check for NULL before dereferencing untrusted pointers.
from Helg Bredow.
Diffstat (limited to 'lib/libfuse')
-rw-r--r--lib/libfuse/fuse.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c
index f1d3ec32a73..73cb076ec0b 100644
--- a/lib/libfuse/fuse.c
+++ b/lib/libfuse/fuse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse.c,v 1.30 2017/10/24 09:01:05 mpi Exp $ */
+/* $OpenBSD: fuse.c,v 1.31 2017/10/25 09:29:46 mpi Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -426,10 +426,14 @@ fuse_parse_cmdline(struct fuse_args *args, char **mp, int *mt, unused int *fg)
return (-1);
}
- *mp = strdup(opt.mp);
- if (*mp == NULL)
- return (-1);
- *mt = 0;
+ if (mp != NULL) {
+ *mp = strdup(opt.mp);
+ if (*mp == NULL)
+ return (-1);
+ }
+
+ if (mt != NULL)
+ *mt = 0;
return (0);
}