diff options
author | Joseph Mingrone <jrm@FreeBSD.org> | 2024-09-06 02:11:27 +0000 |
---|---|---|
committer | Joseph Mingrone <jrm@FreeBSD.org> | 2024-09-06 02:36:15 +0000 |
commit | 75d9de99aec2d9f3bdc495c91bbd6d7a2392e2a3 (patch) | |
tree | 99d6c086833d530e5d1d33a8128961f8149843f0 /smbutil.c | |
parent | 51a183021fce3928d24b11c319d2787f5a15ae87 (diff) |
Diffstat (limited to 'smbutil.c')
-rw-r--r-- | smbutil.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/smbutil.c b/smbutil.c index 97217a8d9fc6..fa5e133fa2a8 100644 --- a/smbutil.c +++ b/smbutil.c @@ -6,9 +6,7 @@ * or later */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #include "netdissect-stdinc.h" @@ -251,7 +249,7 @@ name_len(netdissect_options *ndo, s += GET_U_1(s) + 1; ND_TCHECK_1(s); } - return(ND_BYTES_BETWEEN(s, s0) + 1); + return(ND_BYTES_BETWEEN(s0, s) + 1); trunc: return(-1); /* name goes past the end of the buffer */ @@ -334,7 +332,7 @@ write_bits(netdissect_options *ndo, u_int i = 0; while ((p = strchr(fmt, '|'))) { - u_int l = ND_BYTES_BETWEEN(p, fmt); + u_int l = ND_BYTES_BETWEEN(fmt, p); if (l && (val & (1 << i))) ND_PRINT("%.*s ", (int)l, fmt); fmt = p + 1; @@ -493,7 +491,7 @@ smb_fdata1(netdissect_options *ndo, u_int l; p = strchr(++fmt, '}'); - l = ND_BYTES_BETWEEN(p, fmt); + l = ND_BYTES_BETWEEN(fmt, p); if (l > sizeof(bitfmt) - 1) l = sizeof(bitfmt)-1; @@ -742,8 +740,9 @@ smb_fdata1(netdissect_options *ndo, switch (t) { case 1: - name_type = name_extract(ndo, startbuf, ND_BYTES_BETWEEN(buf, startbuf), - maxbuf, nbuf); + name_type = name_extract(ndo, startbuf, + ND_BYTES_BETWEEN(startbuf, buf), + maxbuf, nbuf); if (name_type < 0) goto trunc; len = name_len(ndo, buf, maxbuf); @@ -799,8 +798,8 @@ smb_fdata1(netdissect_options *ndo, break; } if (t != 0) { - tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y", - localtime(&t)); + tstring = nd_format_time(buffer, sizeof(buffer), "%Y-%m-%d %T", + localtime(&t)); } else tstring = "NULL"; ND_PRINT("%s\n", tstring); @@ -933,7 +932,7 @@ smb_fdata(netdissect_options *ndo, } } if (!depth && buf < maxbuf) { - u_int len = ND_BYTES_BETWEEN(maxbuf, buf); + u_int len = ND_BYTES_BETWEEN(buf, maxbuf); ND_PRINT("Data: (%u bytes)\n", len); smb_data_print(ndo, buf, len); return(buf + len); |