projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3c8b5ba
)
snprintf(... "%s"...) => safe_strncpy
author
Denis Vlasenko
<vda.linux@googlemail.com>
Mon, 4 Jun 2007 21:03:51 +0000
(21:03 -0000)
committer
Denis Vlasenko
<vda.linux@googlemail.com>
Mon, 4 Jun 2007 21:03:51 +0000
(21:03 -0000)
networking/libiproute/utils.c
patch
|
blob
|
history
diff --git
a/networking/libiproute/utils.c
b/networking/libiproute/utils.c
index 7fc1dbc266d9a01f18b904394b37b54005eeebc0..a0d08246a4c33943ca62c497542c905d38ee874c 100644
(file)
--- a/
networking/libiproute/utils.c
+++ b/
networking/libiproute/utils.c
@@
-316,9
+316,12
@@
const char *format_host(int af, int len, void *addr, char *buf, int buflen)
default:;
}
}
- if (len > 0 && (h_ent = gethostbyaddr(addr, len, af)) != NULL) {
- snprintf(buf, buflen - 1, "%s", h_ent->h_name);
- return buf;
+ if (len > 0) {
+ h_ent = gethostbyaddr(addr, len, af);
+ if (h_ent != NULL) {
+ safe_strncpy(buf, h_ent->h_name, buflen);
+ return buf;
+ }
}
}
#endif