]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
Clean up ISAKMP dissection, use nd_ types and EXTRACT_ macros.
[tcpdump] / smbutil.c
index 8f081b7240a9d5ac325af7e6c8a339656dffc851..253721dbe605dab49b467246ccf3ba71a0ba3fef 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -103,7 +103,7 @@ interpret_long_date(const u_char *p)
     time_t ret;
 
     /* this gives us seconds since jan 1st 1601 (approx) */
-    d = (EXTRACT_LE_U_4(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24));
+    d = (EXTRACT_LE_U_4(p + 4) * 256.0 + EXTRACT_U_1(p + 3)) * (1.0e-7 * (1 << 24));
 
     /* now adjust by 369 years to make the secs since 1970 */
     d -= 369.0 * 365.25 * 24 * 60 * 60;
@@ -150,7 +150,7 @@ name_interpret(netdissect_options *ndo,
            *out = 0;
            return(0);
        }
-       *out = ((in[0] - 'A') << 4) + (in[1] - 'A');
+       *out = ((EXTRACT_U_1(in) - 'A') << 4) + (EXTRACT_U_1(in + 1) - 'A');
        in += 2;
        out++;
     }
@@ -481,7 +481,7 @@ smb_fdata1(netdissect_options *ndo,
        case 'P':
          {
            int l = atoi(fmt + 1);
-           ND_TCHECK2(buf[0], l);
+           ND_TCHECK_LEN(buf, l);
            buf += l;
            fmt++;
            while (isdigit((unsigned char)*fmt))
@@ -653,7 +653,7 @@ smb_fdata1(netdissect_options *ndo,
        case 's':
          {
            int l = atoi(fmt + 1);
-           ND_TCHECK2(*buf, l);
+           ND_TCHECK_LEN(buf, l);
            ND_PRINT((ndo, "%-*.*s", l, l, buf));
            buf += l;
            fmt++;
@@ -663,7 +663,7 @@ smb_fdata1(netdissect_options *ndo,
          }
        case 'c':
          {
-           ND_TCHECK2(*buf, stringlen);
+           ND_TCHECK_LEN(buf, stringlen);
            ND_PRINT((ndo, "%-*.*s", (int)stringlen, (int)stringlen, buf));
            buf += stringlen;
            fmt++;
@@ -685,7 +685,7 @@ smb_fdata1(netdissect_options *ndo,
        case 'h':
          {
            int l = atoi(fmt + 1);
-           ND_TCHECK2(*buf, l);
+           ND_TCHECK_LEN(buf, l);
            while (l--) {
                ND_PRINT((ndo, "%02x", EXTRACT_U_1(buf)));
                buf++;