diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2023-06-27 17:59:32 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-06-27 17:59:52 +0800 |
commit | 694f883921cc737de4b2796b89cf45c3bcf6c6bc (patch) | |
tree | bd005eb831ba6c8877a2f52e68cbc4c7b717fcd0 | |
parent | 694db3f4cf6a1389046cfa91bc7ea43a0bec064c (diff) | |
download | linux-crypto-694f883921cc737de4b2796b89cf45c3bcf6c6bc.tar.gz linux-crypto-694f883921cc737de4b2796b89cf45c3bcf6c6bc.zip |
crypto: akcipher - Do not copy dst if it is NULL
As signature verification has a NULL destination buffer, the pointer
needs to be checked before the memcpy is done.
Fixes: 0041a491b5c3 ("crypto: akcipher - Add sync interface without SG lists")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/akcipher.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/akcipher.c b/crypto/akcipher.c index e9b6ddcd..52813f0b 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -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; |