* [PATCH] crypto: akcipher - Do not copy dst if it is NULL
@ 2023-06-27 9:59 Herbert Xu
0 siblings, 0 replies; only message in thread
From: Herbert Xu @ 2023-06-27 9:59 UTC (permalink / raw)
To: Linux Crypto Mailing List
As signature verification has a NULL destination buffer, the pointer
needs to be checked before the memcpy is done.
Fixes: addde1f2c966 ("crypto: akcipher - Add sync interface without SG lists")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/crypto/akcipher.c b/crypto/akcipher.c
index e9b6ddcdf124..52813f0b19e4 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;
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-27 10:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 9:59 [PATCH] crypto: akcipher - Do not copy dst if it is NULL Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).