Browse Source

[core] fix invalid sizeof() identified by coverity

and quiet other coverity warnings
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
6def094c23
  1. 2
      src/inet_ntop_cache.c
  2. 6
      src/server.c

2
src/inet_ntop_cache.c

@ -126,7 +126,7 @@ int sock_addr_nameinfo_append_buffer(server *srv, buffer *b, const sock_addr *ad
else if (AF_INET6 == addr->plain.sa_family) {
char hbuf[256];
if (0 != getnameinfo((const struct sockaddr *)(&addr->ipv6),
sizeof(&addr->ipv6),
sizeof(addr->ipv6),
hbuf, sizeof(hbuf), NULL, 0, 0)) {
log_error_write(srv, __FILE__, __LINE__,
"SSS", "NOTICE: getnameinfo failed: ",

6
src/server.c

@ -517,7 +517,10 @@ static int server_oneshot_init(server *srv, int fd) {
}
/*(must set flags; fd did not pass through fdevent accept() logic)*/
fdevent_fcntl_set_nb_cloexec(srv->ev, fd);
if (-1 == fdevent_fcntl_set_nb_cloexec(srv->ev, fd)) {
log_error_write(srv, __FILE__, __LINE__, "ss", "fcntl:", strerror(errno));
return 0;
}
if (cnt_addr.plain.sa_family != AF_UNIX) {
network_accept_tcp_nagle_disable(fd);
@ -1167,6 +1170,7 @@ static int server_main (server * const srv, int argc, char **argv) {
int devnull;
int errfd;
do {
/* coverity[resource_leak : FALSE] */
devnull = fdevent_open_devnull();
} while (-1 != devnull && devnull <= STDERR_FILENO);
if (-1 == devnull) {

Loading…
Cancel
Save