-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decode/ppp: fix iplen check int handling #10855
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
victorjulien
commented
Apr 16, 2024
•
edited
Loading
edited
** CID 1596376: (CONSTANT_EXPRESSION_RESULT) /src/decode-ppp.c: 64 in DecodePPPCompressedProto() /src/decode-ppp.c: 55 in DecodePPPCompressedProto() ________________________________________________________________________________________________________ *** CID 1596376: (CONSTANT_EXPRESSION_RESULT) /src/decode-ppp.c: 64 in DecodePPPCompressedProto() 58 case 0x57: { /* PPP_IPV6 */ 59 if (unlikely(len < (data_offset + IPV6_HEADER_LEN))) { 60 ENGINE_SET_INVALID_EVENT(p, PPPIPV6_PKT_TOO_SMALL); 61 return TM_ECODE_FAILED; 62 } 63 DEBUG_VALIDATE_BUG_ON(len < data_offset); >>> CID 1596376: (CONSTANT_EXPRESSION_RESULT) >>> "65535 /* 32767 * 2 + 1 */ < (uint16_t)(len - data_offset)" is always false regardless of the values of its operands. This occurs as the logical first operand of "?:". 64 uint16_t iplen = MIN(USHRT_MAX, (uint16_t)(len - data_offset)); 65 return DecodeIPV6(tv, dtv, p, pkt + data_offset, iplen); 66 } 67 case 0x2f: /* PPP_VJ_UCOMP */ 68 if (unlikely(len < (data_offset + IPV4_HEADER_LEN))) { 69 ENGINE_SET_INVALID_EVENT(p, PPPVJU_PKT_TOO_SMALL); /src/decode-ppp.c: 55 in DecodePPPCompressedProto() 49 case 0x21: { /* PPP_IP */ 50 if (unlikely(len < (data_offset + IPV4_HEADER_LEN))) { 51 ENGINE_SET_INVALID_EVENT(p, PPPVJU_PKT_TOO_SMALL); 52 return TM_ECODE_FAILED; 53 } 54 DEBUG_VALIDATE_BUG_ON(len < data_offset); >>> CID 1596376: (CONSTANT_EXPRESSION_RESULT) >>> "65535 /* 32767 * 2 + 1 */ < (uint16_t)(len - data_offset)" is always false regardless of the values of its operands. This occurs as the logical first operand of "?:". 55 uint16_t iplen = MIN(USHRT_MAX, (uint16_t)(len - data_offset)); 56 return DecodeIPV4(tv, dtv, p, pkt + data_offset, iplen); 57 } 58 case 0x57: { /* PPP_IPV6 */ 59 if (unlikely(len < (data_offset + IPV6_HEADER_LEN))) { 60 ENGINE_SET_INVALID_EVENT(p, PPPIPV6_PKT_TOO_SMALL);
inashivb
approved these changes
Apr 16, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #10855 +/- ##
==========================================
+ Coverage 82.88% 82.94% +0.05%
==========================================
Files 914 914
Lines 246936 246936
==========================================
+ Hits 204671 204816 +145
+ Misses 42265 42120 -145
Flags with carried forward coverage won't be shown. Click here to find out more. |
Merged
jasonish
approved these changes
Apr 16, 2024
Merged
Merged in #10865, thanks! |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.