tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD
[abartlet/samba.git/.git] / lib / tsocket / tsocket_bsd.c
index 13680ec0c54793d71cc8bbb0d777f3f84155a9db..9027bc97114f0b10286ede18b416f2ead919bc96 100644 (file)
@@ -883,10 +883,12 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
                return;
        }
 
-       if (ret != state->len) {
-               tevent_req_error(req, EIO);
-               return;
-       }
+       /*
+        * some systems too much bytes in tsocket_bsd_pending()
+        * the return value includes some IP/UDP header bytes
+        */
+       state->len = ret;
+       talloc_realloc(state, state->buf, uint8_t, ret);
 
        tevent_req_done(req);
 }