Skip to content

Commit

Permalink
crypto: akcipher - Do not copy dst if it is NULL
Browse files Browse the repository at this point in the history
As signature verification has a NULL destination buffer, the pointer
needs to be checked before the memcpy is done.

Fixes: addde1f ("crypto: akcipher - Add sync interface without SG lists")
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jun 27, 2023
1 parent 891ebfd commit 486bfb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/akcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ EXPORT_SYMBOL_GPL(crypto_akcipher_sync_prep);
int crypto_akcipher_sync_post(struct crypto_akcipher_sync_data *data, int err)
{
err = crypto_wait_req(err, &data->cwait);
memcpy(data->dst, data->buf, data->dlen);
if (data->dst)
memcpy(data->dst, data->buf, data->dlen);
data->dlen = data->req->dst_len;
kfree_sensitive(data->req);
return err;
Expand Down

0 comments on commit 486bfb0

Please sign in to comment.