summaryrefslogtreecommitdiff
path: root/apps/s_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/s_socket.c')
-rw-r--r--apps/s_socket.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/s_socket.c b/apps/s_socket.c
index bd499d020c..01a980c96d 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -529,9 +529,12 @@ static struct hostent *GetHostByName(char *name)
ret=gethostbyname(name);
if (ret == NULL) return(NULL);
/* else add to cache */
- strncpy(ghbn_cache[lowi].name,name,128);
- memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
- ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
+ if(strlen(name) < sizeof ghbn_cache[0].name)
+ {
+ strcpy(ghbn_cache[lowi].name,name);
+ memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
+ ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
+ }
return(ret);
}
else