diff options
author | Karolin Seeger <kseeger@samba.org> | 2020-07-02 11:05:20 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2020-07-02 11:05:20 +0200 |
commit | 05b8919c7c2c21848feebd94d3cec5ad2162d440 (patch) | |
tree | dfae5e153e3f88b2bdc871c3c589e3c5b6dcc6c1 /libcli | |
parent | 50badbae62f51789a776cd3aa80a80d9aed1d8fe (diff) | |
parent | 6ecd05dfbc201c60346d2ae486663ae0dfc0c09c (diff) | |
download | samba-05b8919c7c2c21848feebd94d3cec5ad2162d440.tar.gz |
Merge tag 'samba-4.12.4' into v4-12-test
samba: tag release samba-4.12.4
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/nbt/nbtsocket.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libcli/nbt/nbtsocket.c b/libcli/nbt/nbtsocket.c index 38a2192fbcd..4c6c20d4fe2 100644 --- a/libcli/nbt/nbtsocket.c +++ b/libcli/nbt/nbtsocket.c @@ -167,8 +167,23 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock) return; } + /* + * Given a zero length, data_blob_talloc() returns the + * NULL blob {NULL, 0}. + * + * We only want to error return here on a real out of memory condition + * (i.e. dsize != 0, so the UDP packet has data, but the return of the + * allocation failed, so blob.data==NULL). + * + * Given an actual zero length UDP packet having blob.data == NULL + * isn't an out of memory error condition, that's the defined semantics + * of data_blob_talloc() when asked for zero bytes. + * + * We still need to continue to do the zero-length socket_recvfrom() + * read in order to clear the "read pending" condition on the socket. + */ blob = data_blob_talloc(tmp_ctx, NULL, dsize); - if (blob.data == NULL) { + if (blob.data == NULL && dsize != 0) { talloc_free(tmp_ctx); return; } |