From 9f292928394bff92216d2d50c51ee25baca8968a Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Wed, 11 Jun 2025 15:46:31 +0200 Subject: [PATCH] - Fix bitwise operators in conditional expressions with parentheses. --- dnstap/dtstream.c | 2 +- doc/Changelog | 3 +++ util/mini_event.c | 4 ++-- util/netevent.c | 16 ++++++++-------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dnstap/dtstream.c b/dnstap/dtstream.c index 2d5ab20f0..39d43403b 100644 --- a/dnstap/dtstream.c +++ b/dnstap/dtstream.c @@ -1509,7 +1509,7 @@ void dtio_output_cb(int ATTR_UNUSED(fd), short bits, void* arg) } #endif - if((bits&UB_EV_READ || dtio->ssl_brief_write)) { + if((bits&UB_EV_READ) || dtio->ssl_brief_write) { #ifdef HAVE_SSL if(dtio->ssl_brief_write) (void)dtio_disable_brief_write(dtio); diff --git a/doc/Changelog b/doc/Changelog index d865dbf41..34c2fdcae 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +11 June 2025: Wouter + - Fix bitwise operators in conditional expressions with parentheses. + 5 June 2025: Wouter - Fix unbound-anchor certificate file read for line ends and end of file. diff --git a/util/mini_event.c b/util/mini_event.c index c05dc668c..2be42b2cc 100644 --- a/util/mini_event.c +++ b/util/mini_event.c @@ -297,10 +297,10 @@ int event_add(struct event* ev, struct timeval* tv) return -1; if( (ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) { ev->ev_base->fds[ev->ev_fd] = ev; - if(ev->ev_events&EV_READ) { + if((ev->ev_events&EV_READ)) { FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->reads); } - if(ev->ev_events&EV_WRITE) { + if((ev->ev_events&EV_WRITE)) { FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->writes); } FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->content); diff --git a/util/netevent.c b/util/netevent.c index 0d0fff429..898db57e9 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -4630,7 +4630,7 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg) } #endif - if(event&UB_EV_TIMEOUT) { + if((event&UB_EV_TIMEOUT)) { verbose(VERB_QUERY, "tcp took too long, dropped"); reclaim_tcp_handler(c); if(!c->tcp_do_close) { @@ -4640,7 +4640,7 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg) } return; } - if(event&UB_EV_READ + if((event&UB_EV_READ) #ifdef USE_MSG_FASTOPEN && !(c->tcp_do_fastopen && (event&UB_EV_WRITE)) #endif @@ -4665,7 +4665,7 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg) tcp_more_read_again(fd, c); return; } - if(event&UB_EV_WRITE) { + if((event&UB_EV_WRITE)) { int has_tcpq = (c->tcp_req_info != NULL); int* morewrite = c->tcp_more_write_again; if(!comm_point_tcp_handle_write(fd, c)) { @@ -5648,7 +5648,7 @@ comm_point_http_handle_callback(int fd, short event, void* arg) log_assert(c->type == comm_http); ub_comm_base_now(c->ev->base); - if(event&UB_EV_TIMEOUT) { + if((event&UB_EV_TIMEOUT)) { verbose(VERB_QUERY, "http took too long, dropped"); reclaim_http_handler(c); if(!c->tcp_do_close) { @@ -5658,7 +5658,7 @@ comm_point_http_handle_callback(int fd, short event, void* arg) } return; } - if(event&UB_EV_READ) { + if((event&UB_EV_READ)) { if(!comm_point_http_handle_read(fd, c)) { reclaim_http_handler(c); if(!c->tcp_do_close) { @@ -5670,7 +5670,7 @@ comm_point_http_handle_callback(int fd, short event, void* arg) } return; } - if(event&UB_EV_WRITE) { + if((event&UB_EV_WRITE)) { if(!comm_point_http_handle_write(fd, c)) { reclaim_http_handler(c); if(!c->tcp_do_close) { @@ -5691,7 +5691,7 @@ void comm_point_local_handle_callback(int fd, short event, void* arg) log_assert(c->type == comm_local); ub_comm_base_now(c->ev->base); - if(event&UB_EV_READ) { + if((event&UB_EV_READ)) { if(!comm_point_tcp_handle_read(fd, c, 1)) { fptr_ok(fptr_whitelist_comm_point(c->callback)); (void)(*c->callback)(c, c->cb_arg, NETEVENT_CLOSED, @@ -5710,7 +5710,7 @@ void comm_point_raw_handle_callback(int ATTR_UNUSED(fd), log_assert(c->type == comm_raw); ub_comm_base_now(c->ev->base); - if(event&UB_EV_TIMEOUT) + if((event&UB_EV_TIMEOUT)) err = NETEVENT_TIMEOUT; fptr_ok(fptr_whitelist_comm_point_raw(c->callback)); (void)(*c->callback)(c, c->cb_arg, err, NULL); -- 2.47.2