1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ndr basic: Check ndr_token_store return code

Fix for

*** CID 1457529:  Error handling issues  (CHECKED_RETURN)
/librpc/ndr/ndr_basic.c: 786 in ndr_push_full_ptr()
...
ID 1457529:  Error handling issues  (CHECKED_RETURN)
    Calling "ndr_token_store" without checking return value (as is done
    elsewhere 14 out of 17 times).

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Thu Jan  9 21:49:00 UTC 2020 on sn-devel-184
This commit is contained in:
Gary Lockyer 2020-01-08 09:39:30 +13:00 committed by Gary Lockyer
parent 60b72f589e
commit 86a31defbf

View File

@ -781,9 +781,13 @@ _PUBLIC_ enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p
/* Check if the pointer already exists and has an id */
ptr = ndr_token_peek(&ndr->full_ptr_list, p);
if (ptr == 0) {
enum ndr_err_code ret = NDR_ERR_SUCCESS;
ndr->ptr_count++;
ptr = ndr->ptr_count;
ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr);
ret = ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr);
if (ret != NDR_ERR_SUCCESS) {
return ret;
}
}
}
return ndr_push_uint3264(ndr, NDR_SCALARS, ptr);