Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-4629 libcfs: fix buffer overflow of string buffer
[fs/lustre-release.git]
/
lnet
/
utils
/
portals.c
diff --git
a/lnet/utils/portals.c
b/lnet/utils/portals.c
index
2a8684c
..
7161f6b
100644
(file)
--- a/
lnet/utils/portals.c
+++ b/
lnet/utils/portals.c
@@
-152,8
+152,7
@@
ptl_ipaddr_2_str(__u32 ipaddr, char *str, size_t strsize, int lookup)
net_ip = htonl (ipaddr);
he = gethostbyaddr (&net_ip, sizeof (net_ip), AF_INET);
if (he != NULL) {
- strncpy(str, he->h_name, strsize - 1);
- str[strsize - 1] = '\0';
+ strlcpy(str, he->h_name, strsize);
return (str);
}
}