Codebase list openssl / 515ac8b
Check the plaintext buffer is large enough when decrypting SM2 Previously there was no check that the supplied buffer was large enough. It was just assumed to be sufficient. Instead we should check and fail if not. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Matt Caswell 2 years ago
1 changed file(s) with 4 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
293293 C2 = sm2_ctext->C2->data;
294294 C3 = sm2_ctext->C3->data;
295295 msg_len = sm2_ctext->C2->length;
296 if (*ptext_len < (size_t)msg_len) {
297 SM2err(SM2_F_SM2_DECRYPT, SM2_R_BUFFER_TOO_SMALL);
298 goto done;
299 }
296300
297301 ctx = BN_CTX_new();
298302 if (ctx == NULL) {