X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ef987f720c3f8fdd536455fefa634d13997ec1f8..10dd76aef1d2b2b6563bc0f3ef066c76461c84d0:/smbutil.c diff --git a/smbutil.c b/smbutil.c index 61086a49..26a52340 100644 --- a/smbutil.c +++ b/smbutil.c @@ -235,11 +235,11 @@ name_len(netdissect_options *ndo, c = EXTRACT_U_1(s); if ((c & 0xC0) == 0xC0) return(2); - while (*s) { + while (EXTRACT_U_1(s)) { if (s >= maxbuf) return(-1); /* name goes past the end of the buffer */ ND_TCHECK_1(s); - s += (*s) + 1; + s += EXTRACT_U_1(s) + 1; ND_TCHECK_1(s); } return(PTR_DIFF(s, s0) + 1); @@ -254,7 +254,7 @@ print_asc(netdissect_options *ndo, { u_int i; for (i = 0; i < len; i++) - safeputchar(ndo, EXTRACT_U_1(buf + i)); + fn_print_char(ndo, EXTRACT_U_1(buf + i)); } static const char * @@ -318,8 +318,7 @@ smb_data_print(netdissect_options *ndo, const u_char *buf, u_int len) return; trunc: - ND_PRINT("\n"); - ND_PRINT("WARNING: Short packet. Try increasing the snap length\n"); + nd_print_trunc(ndo); } @@ -468,7 +467,7 @@ smb_fdata1(netdissect_options *ndo, l = PTR_DIFF(p, fmt); if (l > sizeof(bitfmt) - 1) - l = sizeof(bitfmt)-1; + l = sizeof(bitfmt)-1; strncpy(bitfmt, fmt, l); bitfmt[l] = '\0'; @@ -815,8 +814,7 @@ smb_fdata1(netdissect_options *ndo, return(buf); trunc: - ND_PRINT("\n"); - ND_PRINT("WARNING: Short packet. Try increasing the snap length\n"); + nd_print_trunc(ndo); return(NULL); } @@ -1012,7 +1010,7 @@ static const struct { /* * return a SMB error string from a SMB buffer */ -char * +const char * smb_errstr(int class, int num) { static char ret[128]; @@ -1861,7 +1859,7 @@ static const nt_err_code_struct nt_errors[] = { { 0xC002100A, "RPC_P_SEND_FAILED" }, { 0xC002100B, "RPC_P_TIMEOUT" }, { 0xC002100C, "RPC_P_SERVER_TRANSPORT_ERROR" }, - { 0xC002100E, "RPC_P_EXCEPTION_OCCURED" }, + { 0xC002100E, "RPC_P_EXCEPTION_OCCURRED" }, { 0xC0021012, "RPC_P_CONNECTION_SHUTDOWN" }, { 0xC0021015, "RPC_P_THREAD_LISTENING" }, { 0xC0030001, "RPC_NT_NO_MORE_ENTRIES" },