diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2013-11-09 10:35:32 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2013-11-09 10:35:32 +0000 |
commit | 3bf3ee1f594c2f7fde80b63ed99f4fac9a67e1f2 (patch) | |
tree | 20629ed272f3772fbe1ff52ae517524947e65816 /lib | |
parent | 4aba4ce33baf3a477585033e9fcecd9710d31758 (diff) |
Properly check realpath() return value during argv processing in libfuse.
tweak & ok syl@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfuse/fuse.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c index 6d65446b8f3..02428db0735 100644 --- a/lib/libfuse/fuse.c +++ b/lib/libfuse/fuse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse.c,v 1.14 2013/11/07 18:15:09 syl Exp $ */ +/* $OpenBSD: fuse.c,v 1.15 2013/11/09 10:35:31 stsp Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -360,9 +360,14 @@ ifuse_process_opt(void *data, const char *arg, int key, struct fuse_args *args) case FUSE_OPT_KEY_NONOPT: if (opt->mp == NULL) { opt->mp = realpath(arg, opt->mp); - res = stat(opt->mp, &st); + if (opt->mp == NULL) { + fprintf(stderr, "fuse: realpath: " + "%s : %s\n", arg, strerror(errno)); + return (-1); + } - if (!opt->mp || res == -1) { + res = stat(opt->mp, &st); + if (res == -1) { fprintf(stderr, "fuse: bad mount point " "%s : %s\n", arg, strerror(errno)); return (-1); |