mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
snprintf(... "%s"...) => safe_strncpy
This commit is contained in:
parent
3c8b5ba8e8
commit
8c1aaf3297
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user