]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Include the padding in the length we return.
authorGuy Harris <[email protected]>
Sat, 18 May 2019 02:40:26 +0000 (19:40 -0700)
committerGuy Harris <[email protected]>
Sat, 18 May 2019 02:40:26 +0000 (19:40 -0700)
That length is used to advance the pointer into the packet, so it has to
include the padding.

smbutil.c

index 817573e40d42024209683199581cf208a09596c5..90d6cdf1caec3dc3fa76791372604699ecad73cc 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -348,6 +348,7 @@ unistr(netdissect_options *ndo,
     size_t l = 0;
     uint32_t strsize;
     const u_char *sp;
+    int padding = 0;
 
     if (use_unicode) {
        /*
@@ -356,6 +357,7 @@ unistr(netdissect_options *ndo,
        if (((s - startbuf) % 2) != 0) {
            ND_TCHECK_1(s);
            s++;
+           padding++;
        }
     }
     if (*len == 0) {
@@ -383,11 +385,13 @@ unistr(netdissect_options *ndo,
            }
            strsize = *len - 2;
        }
+       *len += padding;
     } else {
        /*
         * Counted string.
         */
        strsize = *len;
+       *len += padding;
     }
     if (!use_unicode) {
        while (strsize != 0) {