]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ndr: maintain proper talloc tree in pull_string_array
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 29 Jul 2020 22:46:17 +0000 (10:46 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 3 Aug 2020 02:51:35 +0000 (02:51 +0000)
We don't want to leave other parts of the ndr struct hanging off this
string array just because LIBNDR_FLAG_REMAINING is used.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
librpc/ndr/ndr_string.c

index 25f211b2ad3a83bde1f6f9fc0fc0f95a4dfca8f3..4fd2006be203fbd4df976e3654f171e783113247 100644 (file)
@@ -380,12 +380,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_f
                        tmp_ctx = ndr->current_mem_ctx;
                        ndr->current_mem_ctx = a;
                        NDR_CHECK(ndr_pull_string(ndr, ndr_flags, &s));
+                       ndr->current_mem_ctx = tmp_ctx;
                        if ((ndr->data_size - ndr->offset) == 0 && ndr->flags & LIBNDR_FLAG_REMAINING)
                        {
                                a[count] = s;
                                break;
                        }
-                       ndr->current_mem_ctx = tmp_ctx;
                        if (strcmp("", s)==0) {
                                a[count] = NULL;
                                break;