diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-10-25 09:29:47 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-10-25 09:29:47 +0000 |
commit | d3ddeeb366f1f76ecb30b26abc81bfb007f69833 (patch) | |
tree | cf5aa3c72859f9ac9c020ca25a6ce0684f6a6d8f /lib/libfuse | |
parent | 860ce566d388e383a0ad004238f6ea64ec9752fb (diff) |
Check for NULL before dereferencing untrusted pointers.
from Helg Bredow.
Diffstat (limited to 'lib/libfuse')
-rw-r--r-- | lib/libfuse/fuse.c | 14 |
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); } |