diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-09-21 22:54:26 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2012-09-28 09:23:08 +0200 |
commit | c362ed52f22348e8621703e43e539a9f090b00bc (patch) | |
tree | 559437b288b11f5dda5876c5348f1ca7dd8f1991 | |
parent | 036c23a33a8420d4529094adb29f03f587c30dfc (diff) | |
download | samba-c362ed52f22348e8621703e43e539a9f090b00bc.tar.gz |
lib/tsocket: fix receiving of udp packets from 0 bytes (bug #9184)
It's possible for a client to send 0 bytes in a UDP packet,
we need still need to call recvfrom() and skip the invalid
packet at a higher level. Otherwise the kernel receive queue
is blocked.
metze
-rw-r--r-- | lib/tsocket/tsocket_bsd.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c index 9e800652270..d5721b4d94e 100644 --- a/lib/tsocket/tsocket_bsd.c +++ b/lib/tsocket/tsocket_bsd.c @@ -876,10 +876,6 @@ static void tdgram_bsd_recvfrom_handler(void *private_data) bool retry; ret = tsocket_bsd_pending(bsds->fd); - if (ret == 0) { - /* retry later */ - return; - } err = tsocket_bsd_error_from_errno(ret, errno, &retry); if (retry) { /* retry later */ @@ -889,6 +885,7 @@ static void tdgram_bsd_recvfrom_handler(void *private_data) return; } + /* note that 'ret' can be 0 here */ state->buf = talloc_array(state, uint8_t, ret); if (tevent_req_nomem(state->buf, req)) { return; |