From: Matthew Daley <mattjd@gmail.com>
To: Steve Calandra <steven.calandra@gmail.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [BUG]Buffer Overflow in string library
Date: Mon, 16 Sep 2013 12:05:26 +1200 [thread overview]
Message-ID: <CA+nUz_KU33EQ-0NSW4zZDOq+w1L_r5oWS49841143ifkTgcpDw@mail.gmail.com> (raw)
In-Reply-To: <CAHzqaHLSq2xu0VeEOvE1+7JyPx7F8ZYt6qKY68RfH108dsWW3A@mail.gmail.com>
(re-adding xen-devel; if you meant to drop it, you need to say so explicitly.)
On Mon, Sep 16, 2013 at 8:00 AM, Steve Calandra
<steven.calandra@gmail.com> wrote:
> Hey, thanks for the reply. In addition to helping the project, this also
> forwards my thesis research, so thanks.
Cool.
>
>>Which string.c? There are multiple, but I'm guessing xen/common/string.c.
>
> Yes, xen/common/string.c (Sorry, I didn't realize there was more than one.)
>
>
>>I can't see this (broken?) line in any of Xen's source...?
>
> It's at line 60 in xen/common/string.c. Not sure why you can't find it? I
> pulled the latest to make sure it wasn't removed in the time that I
> submitted this and you looked at, but it's still there.
http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/common/string.c;h=9a5a4ba5e8a89e3493bd019699e652401a0cf7d2;hb=HEAD#l60
That's the current source of xen/common/string.c at line 60 in master.
I still can't see it... (note that I'm only referring to the
> size_t destLen = strLen(dest);
line, which declares an unused variable, as well as uses "strLen"
instead of "strlen" (note the case.)
>>Well, 'size' only needs to be bigger than the 'dest' buffer size to
>>cause a write overflow, but that's moot anyway; strlcpy is a
>>well-known function provided by many C standard libraries, and it
>>provides no claims as to the safety of calling it with a 'size' bigger
>>than the 'dest' buffer size.
>
> Right, as far as an overflow goes, it only needs to be bigger than dest. I
> specified both
> because the ternary statement seems to handle the case when size > src, but
> not dest.
Yes. The safety strlcpy provides over strcpy (vs. strncpy) is that it
always NULL-terminates 'dest' (assuming non-zero 'size'). It still
doesn't provide any safety over overflowing 'dest' if 'size' is wrong.
> I hadn't noticed the #ifndef around the function, so I thought this was
> implemented as an alternative to the standard C function. I guess that
> makes this less of a problem.
Right. Note that OpenBSD's version of the function has the same
non-issue: http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcpy.c?rev=1.11
If there was, however, a *user* of strlcpy that specified a 'size'
larger than that of 'dest', *that* would be an issue. As an aside, any
security problems should be reported privately to
security@xenproject.org, and not xen-devel. They'll look at anything
reported with a community-formed (and IMO sensible) process.
- Matthew
next parent reply other threads:[~2013-09-16 0:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAHzqaHLSq2xu0VeEOvE1+7JyPx7F8ZYt6qKY68RfH108dsWW3A@mail.gmail.com>
2013-09-16 0:05 ` Matthew Daley [this message]
2013-09-13 21:33 [BUG]Buffer Overflow in string library Steve Calandra
2013-09-14 16:03 ` Matthew Daley
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=CA+nUz_KU33EQ-0NSW4zZDOq+w1L_r5oWS49841143ifkTgcpDw@mail.gmail.com \
--to=mattjd@gmail.com \
--cc=steven.calandra@gmail.com \
--cc=xen-devel@lists.xen.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).