summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2013-11-09 10:35:31 +0000
committerstsp <stsp@openbsd.org>2013-11-09 10:35:31 +0000
commit487e5ad76625ce2bf3f787fe0ae10821c2b6b760 (patch)
tree3e003b26c38da59d115bb3ff7162b67696715b1d
parentIn our USB world, timeouts are in milliseconds, so use timeout_add_msec() (diff)
downloadwireguard-openbsd-487e5ad76625ce2bf3f787fe0ae10821c2b6b760.tar.xz
wireguard-openbsd-487e5ad76625ce2bf3f787fe0ae10821c2b6b760.zip
Properly check realpath() return value during argv processing in libfuse.
tweak & ok syl@
-rw-r--r--lib/libfuse/fuse.c11
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);