From: Karel Zak <kzak@redhat.com>
To: Jann Horn <jann@thejh.net>
Cc: util-linux@vger.kernel.org
Subject: Re: util-linux: wall security issue: unprivileged users can suppress banner
Date: Mon, 30 Mar 2015 14:12:23 +0200 [thread overview]
Message-ID: <20150330121223.GT1749@ws.net.home> (raw)
In-Reply-To: <20150330112129.GA24751@pc.thejh.net>
On Mon, Mar 30, 2015 at 01:21:29PM +0200, Jann Horn wrote:
> On Mon, Mar 30, 2015 at 11:44:47AM +0200, Karel Zak wrote:
> > > +static void buf_append(char *data, char **buf, size_t *size, size_t *used)
> > > +{
> > > + size_t data_len = strlen(data);
> > > + while (data_len > *size - *used) {
> > > + *size = 2 * *size;
> >
> > How do you know that "2 * size" is enough for data_len?
>
> I don't. It probably usually is, but if it's not, the while loop is going
> to increase the size again and again until it fits.
Ah... not sure why, but I have read "while() as "if ()". Sorry.
> > if you replace xfmkstemp() with open_memstream() than you don't need
> > all the buf_append() changes. libc is able to use FILE as in memory
> > buffer for fprintf-like function :-)
>
> Which libcs? The manpage for open_memstream() says something about "not
> widely available on other systems". Is that acceptable? The wall code
This is good question, we already use mem-streams in libsmartcols (and
cfdisk depends on this functionality since v2.25) and nobody complains.
uClibc supports mem-streams, not sure if people use util-linux with
about another non-glibc alternatives.
It does not mean that your solution is bad, it was just hint. I have
no problem to accept your solution.
> even avoids the use of snprintf because it "is not always available".
snprintf() is absolutely fine, we use it in util-linux everywhere. The
note in the code is pretty obsolete.
I'm going to review more carefully the patch later this week. Thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2015-03-30 12:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150327182707.GA9561@pc.thejh.net>
2015-03-30 9:44 ` util-linux: wall security issue: unprivileged users can suppress banner Karel Zak
2015-03-30 11:21 ` Jann Horn
2015-03-30 12:12 ` Karel Zak [this message]
2015-04-03 9:51 ` Karel Zak
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=20150330121223.GT1749@ws.net.home \
--to=kzak@redhat.com \
--cc=jann@thejh.net \
--cc=util-linux@vger.kernel.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