comparison fuzz/fuzz-common.c @ 1802:19b28d2fbe30

fuzz: handle errors from wrapfd_new_dummy()
author Matt Johnston <matt@ucc.asn.au>
date Sat, 06 Mar 2021 22:58:57 +0800
parents 4983a6bc1f51
children
comparison
equal deleted inserted replaced
1801:4983a6bc1f51 1802:19b28d2fbe30
228 *ret_writefd = wrapfd_new_dummy(); 228 *ret_writefd = wrapfd_new_dummy();
229 *ret_readfd = wrapfd_new_dummy(); 229 *ret_readfd = wrapfd_new_dummy();
230 if (ret_errfd) { 230 if (ret_errfd) {
231 *ret_errfd = wrapfd_new_dummy(); 231 *ret_errfd = wrapfd_new_dummy();
232 } 232 }
233 *ret_pid = 999; 233 if (*ret_writefd == -1 || *ret_readfd == -1 || (ret_errfd && *ret_errfd == -1)) {
234 return DROPBEAR_SUCCESS; 234 m_close(*ret_writefd);
235 } 235 m_close(*ret_readfd);
236 236 if (ret_errfd) {
237 m_close(*ret_errfd);
238 }
239 return DROPBEAR_FAILURE;
240 } else {
241 *ret_pid = 999;
242 return DROPBEAR_SUCCESS;
243
244 }
245 }
237 246
238 /* Fake dropbear_listen, always returns failure for now. 247 /* Fake dropbear_listen, always returns failure for now.
239 TODO make it sometimes return success with wrapfd_new_dummy() sockets. 248 TODO make it sometimes return success with wrapfd_new_dummy() sockets.
240 Making the listeners fake a new incoming connection will be harder. */ 249 Making the listeners fake a new incoming connection will be harder. */
241 /* Listen on address:port. 250 /* Listen on address:port.