Use strlcpy() instead of strncpy() to ensure that ret->name is
NUL terminated. The source and destination buffers are the same size and the source *should* be NUL terminated, but be paranoid. Reported by: Coverity CID: 1011274 MFC after: 1 week
This commit is contained in:
parent
7ff462184f
commit
4e9e03d38e
@ -623,7 +623,7 @@ addmach(char *name, struct sockaddr_in *addr, struct netinfo *ntp)
|
||||
}
|
||||
ret->addr = *addr;
|
||||
ret->ntp = ntp;
|
||||
(void)strncpy(ret->name, name, sizeof(ret->name));
|
||||
(void)strlcpy(ret->name, name, sizeof(ret->name));
|
||||
ret->good = good_host_name(name);
|
||||
ret->l_fwd = &self;
|
||||
ret->l_bak = self.l_bak;
|
||||
|
Loading…
Reference in New Issue
Block a user