Commit dc5b223
authored
Reject len < -1 in ASN1_mbstring_ncopy (#3232)
### Issues:
Addresses `V2196133741`
### Description of changes:
`ASN1_mbstring_ncopy` treats `len == -1` as "call strlen on in". Any
other negative value fell through unchanged and was cast to `size_t` by
`CBS_init`, producing a huge length. Adds an explicit early reject for
`len < -1` with `ASN1_R_ILLEGAL_FORMAT`; `-1` and non-negative values
continue to behave as before.
### Call-outs:
None.
### Testing:
Existing ASN.1 string tests continue to pass.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.1 parent 25a859c commit dc5b223
2 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1711 | 1711 | | |
1712 | 1712 | | |
1713 | 1713 | | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
1714 | 1733 | | |
1715 | 1734 | | |
1716 | 1735 | | |
| |||
0 commit comments