projects
/
sxemacs
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
09dc30c
)
xstrncpy saga
author
Nelson Ferreira
<nelson.ferreira@ieee.org>
Sun, 4 Mar 2012 21:55:45 +0000
(16:55 -0500)
committer
Nelson Ferreira
<nelson.ferreira@ieee.org>
Sun, 4 Mar 2012 21:55:45 +0000
(16:55 -0500)
* src/sysdep.c (init_system_name): use xstrncpy instead of strcpy
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/sysdep.c
patch
|
blob
|
history
diff --git
a/src/sysdep.c
b/src/sysdep.c
index
84457f1
..
f4a9404
100644
(file)
--- a/
src/sysdep.c
+++ b/
src/sysdep.c
@@
-2102,6
+2102,7
@@
void init_system_name(void)
# endif
if (hp) {
const char *fqdn = (const char *)hp->h_name;
+ size_t len = 0;
if (!strchr(fqdn, '.')) {
/* We still don't have a fully qualified domain name.
@@
-2112,8
+2113,9
@@
void init_system_name(void)
if (*alias)
fqdn = *alias;
}
- hostname = (char *)alloca(strlen(fqdn) + 1);
- strcpy(hostname, fqdn);
+ len = strlen(fqdn) + 1;
+ hostname = (char *)alloca(len);
+ xstrncpy(hostname, fqdn,len);
}
# else /* !(HAVE_GETADDRINFO && HAVE_GETNAMEINFO) */
struct addrinfo hints, *res;