diff options
author | 2015-06-03 19:51:16 +0000 | |
---|---|---|
committer | 2015-06-03 19:51:16 +0000 | |
commit | c39b94d2525917335b1a16a333b3891b5fb0b7d9 (patch) | |
tree | 416a9d254ba18c3d4fc4d575a0d8d1428c23ccdf /lib | |
parent | Treat a missing mail spool the same as a zero-length mail spool (diff) | |
download | wireguard-openbsd-c39b94d2525917335b1a16a333b3891b5fb0b7d9.tar.xz wireguard-openbsd-c39b94d2525917335b1a16a333b3891b5fb0b7d9.zip |
It is better to check the asprintf return value for -1 instead of the
input buffer for NULL.
Found by adding __attribute((__warn_unused_result__)) to asprintf.
OK deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfuse/fuse_subr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libfuse/fuse_subr.c b/lib/libfuse/fuse_subr.c index 2bcb1b661f0..c0a4f853fd8 100644 --- a/lib/libfuse/fuse_subr.c +++ b/lib/libfuse/fuse_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_subr.c,v 1.8 2014/04/28 13:08:34 syl Exp $ */ +/* $OpenBSD: fuse_subr.c,v 1.9 2015/06/03 19:51:16 reyk Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -145,7 +145,7 @@ build_realname(struct fuse *f, ino_t ino) struct fuse_vnode *vn; char *name = strdup("/"); char *tmp = NULL; - int firstshot = 0; + int firstshot = 0, ret; vn = tree_get(&f->vnode_tree, ino); if (!vn || !name) { @@ -155,11 +155,11 @@ build_realname(struct fuse *f, ino_t ino) while (vn->parent != 0) { if (firstshot++) - asprintf(&tmp, "/%s%s", vn->path, name); + ret = asprintf(&tmp, "/%s%s", vn->path, name); else - asprintf(&tmp, "/%s", vn->path); + ret = asprintf(&tmp, "/%s", vn->path); - if (tmp == NULL) { + if (ret == -1) { free(name); return (NULL); } |