Commit 64aa393
committed
tls: fix TLSX_PreSharedKey_GetSize word16 overflow (F-2925)
Both TLSX_PreSharedKey_GetSize and TLSX_PreSharedKey_GetSizeBinders
accumulate per-identity bytes into a word16. With enough PSK entries
(or large binderLen/identityLen values) the accumulator wraps silently
and the caller allocates an undersized extension buffer, which
TLSX_PreSharedKey_Write then overflows.
Switch both accumulators to word32 and return LENGTH_ERROR when the
total would exceed the 16-bit wire length field.1 parent ed686d9 commit 64aa393
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11908 | 11908 | | |
11909 | 11909 | | |
11910 | 11910 | | |
11911 | | - | |
| 11911 | + | |
11912 | 11912 | | |
11913 | 11913 | | |
11914 | 11914 | | |
11915 | | - | |
| 11915 | + | |
| 11916 | + | |
| 11917 | + | |
| 11918 | + | |
| 11919 | + | |
11916 | 11920 | | |
11917 | 11921 | | |
11918 | | - | |
| 11922 | + | |
11919 | 11923 | | |
11920 | 11924 | | |
11921 | 11925 | | |
| |||
11938 | 11942 | | |
11939 | 11943 | | |
11940 | 11944 | | |
11941 | | - | |
| 11945 | + | |
11942 | 11946 | | |
11943 | 11947 | | |
11944 | 11948 | | |
| |||
11948 | 11952 | | |
11949 | 11953 | | |
11950 | 11954 | | |
11951 | | - | |
| 11955 | + | |
| 11956 | + | |
| 11957 | + | |
| 11958 | + | |
| 11959 | + | |
11952 | 11960 | | |
11953 | 11961 | | |
11954 | 11962 | | |
11955 | | - | |
| 11963 | + | |
11956 | 11964 | | |
11957 | 11965 | | |
11958 | 11966 | | |
| |||
0 commit comments