tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm LIBNDR_FLAG_STR_ ndr_generic_array
authorStefan Metzmacher <metze@samba.org>
Tue, 22 Mar 2022 00:28:23 +0000 (01:28 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 17 May 2024 11:13:14 +0000 (13:13 +0200)
tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index 5bcaeaf9313671424941335670e669a846957cb5..9a5b5f9721b5af9a81d603520a161b8d84ea97e2 100644 (file)
@@ -367,11 +367,24 @@ sub ElementLevel($$$$$$$$)
                        ($bs = 1) if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_ASCII.*"));
 
                        if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*") and property_matches($e, "flag", ".*LIBNDR_FLAG_STR_LEN4.*")) {
-                               $self->pidl_code("char *data;\n");
-                               $self->pidl_code("offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, di, drep, $bs, $hf, FALSE, &data);");
+                               $self->pidl_code("char *data = NULL;");
+                               $self->pidl_code("struct ndr_generic_array nga = { .is_conformant = FALSE, };");
+                               $self->pidl_code("offset = dissect_ndr_conformant_array_hdr(tvb, offset, pinfo, tree, di, drep, &nga);");
+                               $self->pidl_code("offset = dissect_ndr_varying_array_hdr(tvb, offset, pinfo, tree, di, drep, &nga);");
+                               $self->pidl_code("offset = dissect_ndr_generic_array_string(tvb, offset, pinfo, tree, di, drep, $bs, $hf, FALSE, &nga, &data);");
                                $self->pidl_code("proto_item_append_text(tree, \": %s\", data);");
                        } elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*")) {
-                               $self->pidl_code("offset = dissect_ndr_vstring(tvb, offset, pinfo, tree, di, drep, $bs, $hf, FALSE, NULL);");
+                               $self->pidl_code("char *data = NULL;");
+                               $self->pidl_code("struct ndr_generic_array nga = { .is_conformant = FALSE, };");
+                               $self->pidl_code("offset = dissect_ndr_conformant_array_hdr(tvb, offset, pinfo, tree, di, drep, &nga);");
+                               $self->pidl_code("offset = dissect_ndr_generic_array_string(tvb, offset, pinfo, tree, di, drep, $bs, $hf, FALSE, &nga, &data);");
+                               $self->pidl_code("proto_item_append_text(tree, \": %s\", data);");
+                       } elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_LEN4.*")) {
+                               $self->pidl_code("char *data = NULL;");
+                               $self->pidl_code("struct ndr_generic_array nga = { .is_conformant = FALSE, };");
+                               $self->pidl_code("offset = dissect_ndr_varying_array_hdr(tvb, offset, pinfo, tree, di, drep, &nga);");
+                               $self->pidl_code("offset = dissect_ndr_generic_array_string(tvb, offset, pinfo, tree, di, drep, $bs, $hf, FALSE, &nga, &data);");
+                               $self->pidl_code("proto_item_append_text(tree, \": %s\", data);");
                        } elsif (property_matches($e, "flag", ".*STR_NULLTERM.*")) {
                                if ($bs == 2) {
                                        $self->pidl_code("offset = dissect_null_term_wstring(tvb, offset, pinfo, tree, drep, $hf , 0);")