GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||
GeezerVison is showing github.com — gh-161472: Fix signed char handling in SSL record header version by samitistfobos-dev · Pull Request #161474 · python/cpython Conversation
|
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Problem: In _PySSL_msg_callback (SSL3_RT_HEADER branch, Modules/_ssl/debughelpers.c), the TLS record header version bytes are read through a signed char pointer (const char *cbuf) and combined as version = cbuf[1] << 8 | cbuf[2]. OpenSSL invokes the message callback for a received record header before the version is validated, so both bytes are controlled by the remote peer. When cbuf[1] has its high bit set, a negative value is shifted left (undefined behaviour in C11); when cbuf[2] has its high bit set, sign extension clobbers the upper byte, and the Python msg_callback receives a wrong (negative or sign-extended) version value. Solution: cast both header bytes to unsigned char before the shift and the OR, so the version is always assembled as an unsigned 16-bit value. Signed-off-by: Aleksandr Burlakov <[email protected]>
1049efc to
41d571f
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This change has little impact for Python users, because it's limited to how TLS record header versions are reported through the SSL message callback. Normal TLS connections and record processing are unaffected, and the issue only manifests when handling malformed record headers containing bytes with the high bit set. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
No this still requires a NEWS entry. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please add a test if possible as well |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll provide the test soon |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Provided |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
6b1b06a to
f10388f
Compare
|
@picnixz Can you look again? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Fix signed char handling in SSL record header version
There was an error while loading. Please reload this page.