-
Notifications
You must be signed in to change notification settings - Fork 958
Various fixes #10142
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
base: master
Are you sure you want to change the base?
Various fixes #10142
Changes from all commits
1cd5851
257cae0
e815571
9254bf7
d8fb381
392f7e2
d83ef81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4195,6 +4195,9 @@ static int ProcessClientHello(const byte* input, int* sslBytes, | |
| { | ||
| word16 listLen = 0, offset = 0; | ||
|
|
||
| if (extLen < OPAQUE16_LEN) | ||
| return BUFFER_ERROR; | ||
|
|
||
| ato16(input + offset, &listLen); | ||
| offset += OPAQUE16_LEN; | ||
|
|
||
|
|
@@ -4228,7 +4231,13 @@ static int ProcessClientHello(const byte* input, int* sslBytes, | |
| #ifdef WOLFSSL_TLS13 | ||
| case EXT_KEY_SHARE: | ||
| { | ||
| word16 ksLen = (word16)((input[0] << 8) | input[1]); | ||
| word16 ksLen = 0; | ||
| if (extLen < OPAQUE16_LEN) { | ||
| SetError(BUFFER_ERROR_STR, error, session, FATAL_ERROR_STATE); | ||
| return BUFFER_ERROR; | ||
| } | ||
|
|
||
| ksLen = (word16)((input[0] << 8) | input[1]); | ||
| if (ksLen + OPAQUE16_LEN > extLen) { | ||
| SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE); | ||
| return WOLFSSL_FATAL_ERROR; | ||
|
|
@@ -4252,6 +4261,11 @@ static int ProcessClientHello(const byte* input, int* sslBytes, | |
| word32 ticketAge; | ||
| const byte *identity, *binders; | ||
|
|
||
| if (extLen < OPAQUE16_LEN) { | ||
| SetError(BUFFER_ERROR_STR, error, session, FATAL_ERROR_STATE); | ||
| return BUFFER_ERROR; | ||
| } | ||
|
|
||
| idsLen = (word16)((input[idx] << 8) | input[idx+1]); | ||
| if ((word32)idsLen + OPAQUE16_LEN + idx > (word32)extLen) { | ||
| SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE); | ||
|
Comment on lines
+4264
to
4271
|
||
|
|
||
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.
In this parsing path the function returns
BUFFER_ERRORwithout callingSetError(...), while the other newly added length checks in this function set the error state first. For consistent diagnostics and state handling, consider callingSetError(BUFFER_ERROR_STR, error, session, FATAL_ERROR_STATE)here as well (or use the same non-fatal/fatal pattern used elsewhere in this function).