Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libperfuse Allow setxattr to be called with a NULL value...
details: https://anonhg.NetBSD.org/src/rev/25daec7dfa3d
branches: trunk
changeset: 803791:25daec7dfa3d
user: manu <manu%NetBSD.org@localhost>
date: Wed Nov 12 05:08:43 2014 +0000
description:
Allow setxattr to be called with a NULL value, instead of crashing.
diffstat:
lib/libperfuse/ops.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (49 lines):
diff -r 40aaf487d99a -r 25daec7dfa3d lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Wed Nov 12 04:53:13 2014 +0000
+++ b/lib/libperfuse/ops.c Wed Nov 12 05:08:43 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.80 2014/11/04 09:17:31 manu Exp $ */
+/* $NetBSD: ops.c,v 1.81 2014/11/12 05:08:43 manu Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3460,6 +3460,7 @@
perfuse_msg_t *pm;
struct fuse_setxattr_in *fsi;
size_t attrnamelen;
+ size_t datalen;
size_t len;
char *np;
int error;
@@ -3472,23 +3473,27 @@
ps = puffs_getspecific(pu);
attrname = perfuse_native_ns(attrns, attrname, fuse_attrname);
attrnamelen = strlen(attrname) + 1;
- len = sizeof(*fsi) + attrnamelen + *resid;
+
+ datalen = (resid != NULL) ? *resid : 0;
+ len = sizeof(*fsi) + attrnamelen + datalen;
pm = ps->ps_new_msg(pu, opc, FUSE_SETXATTR, len, pcr);
fsi = GET_INPAYLOAD(ps, pm, fuse_setxattr_in);
- fsi->size = (unsigned int)*resid;
+ fsi->size = (unsigned int)datalen;
fsi->flags = 0;
np = (char *)(void *)(fsi + 1);
(void)strlcpy(np, attrname, attrnamelen);
np += attrnamelen;
- (void)memcpy(np, (char *)attr, *resid);
+ if (datalen)
+ (void)memcpy(np, (char *)attr, datalen);
if ((error = xchg_msg(pu, opc, pm,
NO_PAYLOAD_REPLY_LEN, wait_reply)) != 0)
goto out;
ps->ps_destroy_msg(pm);
- *resid = 0;
+ if (resid)
+ *resid = 0;
error = 0;
out:
Home |
Main Index |
Thread Index |
Old Index