diff options
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/readdir_r.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/gethostname.c | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c index a4462f73e7..6d70233e6e 100644 --- a/sysdeps/unix/readdir_r.c +++ b/sysdeps/unix/readdir_r.c @@ -96,10 +96,7 @@ __readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result) } while (dp->d_ino == 0); if (dp != NULL) - { - memcpy (entry, dp, reclen); - *result = entry; - } + *result = memcpy (entry, dp, reclen); __libc_lock_unlock (dirp->lock); diff --git a/sysdeps/unix/sysv/linux/gethostname.c b/sysdeps/unix/sysv/linux/gethostname.c index 5df8096bfd..0e3ca57aca 100644 --- a/sysdeps/unix/sysv/linux/gethostname.c +++ b/sysdeps/unix/sysv/linux/gethostname.c @@ -30,6 +30,7 @@ __gethostname (name, len) size_t len; { struct utsname buf; + size_t node_len; if (name == NULL) { @@ -40,13 +41,14 @@ __gethostname (name, len) if (uname (&buf)) return -1; - if (strlen (buf.nodename) + 1 > len) + node_len = strlen (buf.nodename) + 1; + if (node_len > len) { __set_errno (EINVAL); return -1; } - strcpy (name, buf.nodename); + memcpy (name, buf.nodename, node_len); return 0; } |