Commit e60e991
authored
sm2: fix SM2PKE ciphertext parsing DoS [SECURITY] (#1603)
This fixes a potential denial-of-service attack in the SM2PKE decryption
implementation originally reported as GHSA-j9xq-69pf-pcm8 by @XlabAITeam
Previously the ciphertext was parsed using `split_at` which panics in
the event the input is not of sufficient length, leading to a potential
DoS if the ciphertext is malformed.
The issue was corrected by replacing `split_at` with `split_at_checked`
which returns `Option::None` in the event the input is of insufficient
length, then propagating an `Error` in such a case.1 parent 085b7be commit e60e991
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
0 commit comments