diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-11-11 21:39:25 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-11-11 21:46:08 +0100 |
commit | d35638710c2566f6257edff64be7826256a37f56 (patch) | |
tree | 6831ffa3328838d244cca50ae136a9ef680eae03 /print-dccp.c | |
parent | 1c803f7812c7cd69cc9a90ac11ead8f48bfba64c (diff) | |
download | tcpdump-d35638710c2566f6257edff64be7826256a37f56.tar.gz |
DCCP: Fix some undefined behaviors at runtime
The errors were like:
print-dccp.c:448:4: runtime error: unsigned integer overflow: 20 - 24
cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior print-dccp.c:448:4
Diffstat (limited to 'print-dccp.c')
-rw-r--r-- | print-dccp.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/print-dccp.c b/print-dccp.c index af47d60e..bf1fc286 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -306,7 +306,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, fixed_hdrlen = dccp_basic_hdr_len(dh); if (len < fixed_hdrlen) { ND_PRINT("truncated-dccp - %u bytes missing!", - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_TCHECK_LEN(dh, fixed_hdrlen); @@ -370,7 +370,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_TCHECK_SIZE(dhr); @@ -386,7 +386,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_TCHECK_SIZE(dhr); @@ -403,7 +403,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_PRINT("%s ", tok2str(dccp_pkt_type_str, "", dccph_type)); @@ -414,7 +414,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_PRINT("%s ", tok2str(dccp_pkt_type_str, "", dccph_type)); @@ -425,7 +425,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_PRINT("%s ", tok2str(dccp_pkt_type_str, "", dccph_type)); @@ -435,7 +435,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_PRINT("%s ", tok2str(dccp_pkt_type_str, "", dccph_type)); @@ -447,7 +447,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_TCHECK_SIZE(dhr); @@ -461,7 +461,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_PRINT("%s ", tok2str(dccp_pkt_type_str, "", dccph_type)); @@ -471,7 +471,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (len < fixed_hdrlen) { ND_PRINT("truncated-%s - %u bytes missing!", tok2str(dccp_pkt_type_str, "", dccph_type), - len - fixed_hdrlen); + fixed_hdrlen - len); return; } ND_PRINT("%s ", tok2str(dccp_pkt_type_str, "", dccph_type)); |