Use strlcpy() when we mean it.
This commit is contained in:
parent
1c10962832
commit
0ea291e221
@ -72,8 +72,7 @@ parse_lt(const char * str)
|
||||
char buf[64];
|
||||
|
||||
/* Make local copy and force lowercase to simplify parsing */
|
||||
p = strncpy(buf, str, sizeof buf);
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
p = strlcpy(buf, str, sizeof buf);
|
||||
for (i = 0; buf[i]; i++)
|
||||
buf[i] = (char)tolower(buf[i]);
|
||||
|
||||
|
@ -59,8 +59,7 @@ logwtmp(const char *line, const char *name, const char *host)
|
||||
char fullhost[MAXHOSTNAMELEN];
|
||||
int fd;
|
||||
|
||||
strncpy(fullhost, host, sizeof(fullhost) - 1);
|
||||
fullhost[sizeof(fullhost) - 1] = '\0';
|
||||
strlcpy(fullhost, host, sizeof(fullhost));
|
||||
trimdomain(fullhost, UT_HOSTSIZE);
|
||||
host = fullhost;
|
||||
|
||||
|
@ -61,8 +61,7 @@ realhostname(char *host, size_t hsize, const struct in_addr *ip)
|
||||
if (strlen(trimmed) <= hsize) {
|
||||
char lookup[MAXHOSTNAMELEN];
|
||||
|
||||
strncpy(lookup, hp->h_name, sizeof(lookup) - 1);
|
||||
lookup[sizeof(lookup) - 1] = '\0';
|
||||
strlcpy(lookup, hp->h_name, sizeof(lookup));
|
||||
hp = gethostbyname(lookup);
|
||||
if (hp == NULL)
|
||||
result = HOSTNAME_INVALIDNAME;
|
||||
|
Loading…
Reference in New Issue
Block a user