From: Mimi Zohar <zohar@linux.ibm.com>
To: Vitaly Chikunov <vt@altlinux.org>,
Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
linux-integrity@vger.kernel.org
Subject: Re: [PATCH v1 2/5] ima-evm-utils: Fix possible strcpy overflow
Date: Mon, 15 Jul 2019 15:08:55 -0400 [thread overview]
Message-ID: <1563217735.4539.145.camel@linux.ibm.com> (raw)
In-Reply-To: <20190712212833.29280-2-vt@altlinux.org>
On Sat, 2019-07-13 at 00:28 +0300, Vitaly Chikunov wrote:
> caps_str is passed from command line but copied into fixed-size buffer.
> CID 229895.
> ---
> src/evmctl.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/evmctl.c b/src/evmctl.c
> index 39bc3d9..e07cff4 100644
> --- a/src/evmctl.c
> +++ b/src/evmctl.c
> @@ -409,8 +409,9 @@ static int calc_evm_hash(const char *file, unsigned char *hash)
> } else if (!strcmp(*xattrname, XATTR_NAME_CAPS) && (hmac_flags & HMAC_FLAG_CAPS_SET)) {
> if (!caps_str)
> continue;
> - strcpy(xattr_value, caps_str);
> err = strlen(caps_str);
> + assert(err < sizeof(xattr_value));
"calc_evm_hash" can be called while walking and labeling, or
verifying, a file system. We probably don't want to abruptly end it.
Maybe emit an error message and return and error?
> + strcpy(xattr_value, caps_str);
> } else {
> err = lgetxattr(file, *xattrname, xattr_value, sizeof(xattr_value));
> if (err < 0) {
next prev parent reply other threads:[~2019-07-15 19:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 21:28 [PATCH v1 1/5] ima-evm-utils: Fix null dereference from file2bin to memcpy Vitaly Chikunov
2019-07-12 21:28 ` [PATCH v1 2/5] ima-evm-utils: Fix possible strcpy overflow Vitaly Chikunov
2019-07-15 19:08 ` Mimi Zohar [this message]
2019-07-15 20:05 ` Vitaly Chikunov
2019-07-12 21:28 ` [PATCH v1 3/5] ima-evm-utils: Fix memory leak in get_password Vitaly Chikunov
2019-07-12 21:28 ` [PATCH v1 4/5] ima-evm-utils: Fix file2bin stat and fopen relations Vitaly Chikunov
2019-07-15 19:09 ` Mimi Zohar
2019-07-15 20:04 ` Vitaly Chikunov
2019-07-12 21:28 ` [PATCH v1 5/5] ima-evm-utils: Add more error checking in add_file_hash Vitaly Chikunov
2019-07-15 19:08 ` [PATCH v1 1/5] ima-evm-utils: Fix null dereference from file2bin to memcpy Mimi Zohar
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=1563217735.4539.145.camel@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=linux-integrity@vger.kernel.org \
--cc=vt@altlinux.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;
as well as URLs for NNTP newsgroup(s).