summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-03 14:15:04 -0700
committerJeremy Allison <jra@samba.org>2011-05-04 12:12:14 -0700
commit2938fe6f90471e8fabf583a5eb585597381df97d (patch)
tree5147a973d0b742feef3f32407846ef1f34f7efac /source3/lib
parente4667926ce752775e9ba1108c4cb41d6f97a04fa (diff)
downloadsamba-2938fe6f90471e8fabf583a5eb585597381df97d.tar.gz
samba-2938fe6f90471e8fabf583a5eb585597381df97d.tar.bz2
samba-2938fe6f90471e8fabf583a5eb585597381df97d.zip
Fold null terminator into listlen length, change to strlcpy.
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 74a8971c53..292965f47f 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -2376,7 +2376,7 @@ static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size)
dirp = fdopendir(newfd);
while ((de = readdir(dirp))) {
- size_t listlen = strlen(de->d_name);
+ size_t listlen = strlen(de->d_name) + 1;
if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) {
/* we don't want "." and ".." here: */
DEBUG(10,("skipped EA %s\n",de->d_name));
@@ -2385,18 +2385,16 @@ static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size)
if (size == 0) {
/* return the current size of the list of extended attribute names*/
- len += listlen + 1;
+ len += listlen;
} else {
/* check size and copy entrieѕ + nul into list. */
- if ((len + listlen + 1) > size) {
+ if ((len + listlen) > size) {
errno = ERANGE;
len = -1;
break;
} else {
- safe_strcpy(list + len, de->d_name, listlen);
+ strlcpy(list + len, de->d_name, listlen);
len += listlen;
- list[len] = '\0';
- ++len;
}
}
}