From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>,
Shannon Zhao <zhaoshenglong@huawei.com>
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com,
qemu-trivial@nongnu.org, mjt@tls.msk.ru, qemu-devel@nongnu.org,
peter.huangpeng@huawei.com, shannon.zhao@linaro.org,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] fsdev/virtfs-proxy-helper: Fix possible overflow
Date: Mon, 30 Mar 2015 19:33:33 +0530 [thread overview]
Message-ID: <87pp7qlgzu.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20150330132941.GK25181@stefanha-thinkpad.redhat.com>
Stefan Hajnoczi <stefanha@gmail.com> writes:
> On Sat, Mar 14, 2015 at 10:00:16AM +0800, Shannon Zhao wrote:
>> It's detected by coverity. As max of sockaddr_un.sun_path is
>> sizeof(helper.sun_path), should check the length of source
>> and use strncpy instead of strcpy.
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>> v1->v2: Still use strcpy [Paolo]
>> ---
>> fsdev/virtfs-proxy-helper.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
>> index bf2e5f3..13fe032 100644
>> --- a/fsdev/virtfs-proxy-helper.c
>> +++ b/fsdev/virtfs-proxy-helper.c
>> @@ -738,6 +738,7 @@ static int proxy_socket(const char *path, uid_t uid, gid_t gid)
>> return -1;
>> }
>>
>> + g_assert(strlen(path) < sizeof(proxy.sun_path));
>> sock = socket(AF_UNIX, SOCK_STREAM, 0);
>
> path is user input. While the assertion check silences Coverity, it is
> not suitable for input validation. Users expect a graceful exit with an
> error message, not an assertion failure if the given path is too long.
>
> I will send a patch.
That is the proxy helper. The assert will cause an exit() which is good,
isn't it ? I did update the qemu side of the patch to do a graceful exit
-aneesh
next prev parent reply other threads:[~2015-03-30 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-14 2:00 [Qemu-devel] [PATCH v2] fsdev/virtfs-proxy-helper: Fix possible overflow Shannon Zhao
2015-03-16 6:31 ` Aneesh Kumar K.V
2015-03-30 13:29 ` Stefan Hajnoczi
2015-03-30 14:03 ` Aneesh Kumar K.V [this message]
2015-03-31 14:07 ` Stefan Hajnoczi
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=87pp7qlgzu.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=hangaohuai@huawei.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=shannon.zhao@linaro.org \
--cc=stefanha@gmail.com \
--cc=zhaoshenglong@huawei.com \
/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).