Skip to content

Commit

Permalink
fix udpsockread segfault after connections realloc
Browse files Browse the repository at this point in the history
  • Loading branch information
msaf1980 committed Mar 22, 2019
1 parent 973e08b commit c23b85e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,14 @@ dispatch_addconnection(int sock, listener *lsnr)

pthread_rwlock_unlock(&connectionslock);
return -1;
} else if (newlst != connections) {
/* reset srcaddr after realloc due to issue 346 */
for (c = 0; c < connectionslen; c++) {
if (newlst[c].isudp) {
newlst[c].strm->hdl.udp.srcaddr = newlst[c].srcaddr;
newlst[c].strm->hdl.udp.srcaddrlen = sizeof(newlst[c].srcaddr);
}
}
}

for (c = connectionslen; c < connectionslen + CONNGROWSZ; c++) {
Expand Down

0 comments on commit c23b85e

Please sign in to comment.