comparison common-session.c @ 1596:60fceff95858

workaround memory sanitizer FD_ZERO false positives
author Matt Johnston <matt@ucc.asn.au>
date Tue, 06 Mar 2018 21:51:51 +0800
parents 399d8eb961b5
children aabde6f57fce
comparison
equal deleted inserted replaced
1595:4fe7cc9e45eb 1596:60fceff95858
150 for(;;) { 150 for(;;) {
151 const int writequeue_has_space = (ses.writequeue_len <= 2*TRANS_MAX_PAYLOAD_LEN); 151 const int writequeue_has_space = (ses.writequeue_len <= 2*TRANS_MAX_PAYLOAD_LEN);
152 152
153 timeout.tv_sec = select_timeout(); 153 timeout.tv_sec = select_timeout();
154 timeout.tv_usec = 0; 154 timeout.tv_usec = 0;
155 FD_ZERO(&writefd); 155 DROPBEAR_FD_ZERO(&writefd);
156 FD_ZERO(&readfd); 156 DROPBEAR_FD_ZERO(&readfd);
157
157 dropbear_assert(ses.payload == NULL); 158 dropbear_assert(ses.payload == NULL);
158 159
159 /* We get woken up when signal handlers write to this pipe. 160 /* We get woken up when signal handlers write to this pipe.
160 SIGCHLD in svr-chansession is the only one currently. */ 161 SIGCHLD in svr-chansession is the only one currently. */
161 #if DROPBEAR_FUZZ 162 #if DROPBEAR_FUZZ
202 if (val <= 0) { 203 if (val <= 0) {
203 /* If we were interrupted or the select timed out, we still 204 /* If we were interrupted or the select timed out, we still
204 * want to iterate over channels etc for reading, to handle 205 * want to iterate over channels etc for reading, to handle
205 * server processes exiting etc. 206 * server processes exiting etc.
206 * We don't want to read/write FDs. */ 207 * We don't want to read/write FDs. */
207 FD_ZERO(&writefd); 208 DROPBEAR_FD_ZERO(&writefd);
208 FD_ZERO(&readfd); 209 DROPBEAR_FD_ZERO(&readfd);
209 } 210 }
210 211
211 /* We'll just empty out the pipe if required. We don't do 212 /* We'll just empty out the pipe if required. We don't do
212 any thing with the data, since the pipe's purpose is purely to 213 any thing with the data, since the pipe's purpose is purely to
213 wake up the select() above. */ 214 wake up the select() above. */
404 405
405 if (count < 1) { 406 if (count < 1) {
406 return -1; 407 return -1;
407 } 408 }
408 409
409 FD_ZERO(&fds); 410 DROPBEAR_FD_ZERO(&fds);
410 411
411 /* select since it's a non-blocking fd */ 412 /* select since it's a non-blocking fd */
412 413
413 /* leave space to null-terminate */ 414 /* leave space to null-terminate */
414 while (pos < count-1) { 415 while (pos < count-1) {