From: Prestwood, James <james.prestwood@intel.com>
To: iwd@lists.01.org
Subject: Re: [PATCH] crypto: fix copy size causing overruns/crashing
Date: Thu, 03 Oct 2019 16:44:56 +0000 [thread overview]
Message-ID: <d5eab9f2eececb6530ff6d466f6484d28412c836.camel@intel.com> (raw)
In-Reply-To: <20191003113516.GC8802@dtznix>
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
Hi Will,
On Thu, 2019-10-03 at 11:35 -0500, Will Dietz wrote:
> num_ad is already accounted for in `sizeof(iov)`
> as iov has size `sizeof(struct iovec) * (num_ad+1)`.
> ---
> src/crypto.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/crypto.c b/src/crypto.c
> index 632117d..62edd44 100644
> --- a/src/crypto.c
> +++ b/src/crypto.c
> @@ -311,7 +311,7 @@ bool aes_siv_encrypt(const uint8_t *key, size_t
> key_len, const uint8_t *in,
> struct iovec iov[num_ad + 1];
> uint8_t v[16];
>
> - memcpy(iov, ad, sizeof(iov) * num_ad);
> + memcpy(iov, ad, sizeof(struct iovec) * num_ad);
Good catch! I'm fine with this way, but also fine with simply removing
* num_ad and leaving sizeof(iov) as is. Lets see what Denis prefers.
Thanks,
James
> _______________________________________________
> iwd mailing list -- iwd(a)lists.01.org
> To unsubscribe send an email to iwd-leave(a)lists.01.org
next prev parent reply other threads:[~2019-10-03 16:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 16:35 [PATCH] crypto: fix copy size causing overruns/crashing Will Dietz
2019-10-03 16:44 ` Prestwood, James [this message]
2019-10-03 16:47 ` Prestwood, James
2019-10-03 16:47 ` Denis Kenzior
2019-10-03 16:53 ` Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2019-10-03 17:18 Will Dietz
2019-10-03 17:28 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5eab9f2eececb6530ff6d466f6484d28412c836.camel@intel.com \
--to=james.prestwood@intel.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox