summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmbclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/libsmbclient.c')
-rw-r--r--source3/libsmb/libsmbclient.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index da8f1e332b..179f6eba5d 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -6241,6 +6241,7 @@ smbc_listxattr_ctx(SMBCCTX *context,
* the complete set of attribute names, always, rather than only those
* attribute names which actually exist for a file. Hmmm...
*/
+ size_t retsize;
const char supported_old[] =
"system.*\0"
"system.*+\0"
@@ -6284,22 +6285,24 @@ smbc_listxattr_ctx(SMBCCTX *context,
if (context->internal->_full_time_names) {
supported = supported_new;
+ retsize = sizeof(supported_new);
} else {
supported = supported_old;
+ retsize = sizeof(supported_old);
}
if (size == 0) {
- return sizeof(supported);
+ return retsize;
}
- if (sizeof(supported) > size) {
+ if (retsize > size) {
errno = ERANGE;
return -1;
}
/* this can't be strcpy() because there are embedded null characters */
- memcpy(list, supported, sizeof(supported));
- return sizeof(supported);
+ memcpy(list, supported, retsize);
+ return retsize;
}