From: michal at ellpspace.math.ualberta.ca (Michal Jaegermann)
Subject: buffer overflow in srm_env_write?!
Date: Mon, 14 Mar 2005 13:47:09 -0700 [thread overview]
Message-ID: <20050314134709.A20634@ellpspace.math.ualberta.ca> (raw)
In-Reply-To: <87hdjeujhb.fsf@debian.org>; from falk@debian.org on Mon, Mar 14, 2005 at 08:15:44PM +0100
On Mon, Mar 14, 2005 at 08:15:44PM +0100, Falk Hueffner wrote:
> Heid Oliver <oliver.heid at siemens.com> writes:
>
> > here it is.
> >
> > --- arch/alpha/kernel/srm_env.c~ 2005-03-02 08:37:49.000000000 +0100
> > +++ arch/alpha/kernel/srm_env.c 2005-03-14 17:00:48.000000000 +0100
> > @@ -152,7 +152,7 @@
> > res = -EFAULT;
> > if (copy_from_user(buf, buffer, count))
> > goto out;
> > - buf[count] = '\0';
> > + buf[count-1] = '\0';
> >
> > ret1 = callback_setenv(entry->id, buf, count);
> > if ((ret1 >> 61) == 0) {
> > ---
>
> That will nuke the kernel if count == 0.
Do we ever really want a traling newline here? If not then
such code in srm_env.c may cause the least surprises:
if (copy_from_user(buf, buffer, count))
goto out;
if (count > 0 && buf[count-1] == '\n')
count -= 1;
buf[count] = '\0';
ret1 = callback_setenv(entry->id, buf, count);
.....
Although then if want that newline you have to do something
like
echo "extra newline
"
which will be not obvious.
Michal
next prev parent reply other threads:[~2005-03-14 20:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-14 16:19 buffer overflow in srm_env_write?! oliver.heid
2005-03-14 19:15 ` falk
2005-03-14 20:47 ` michal [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-03-11 12:23 oliver.heid
2005-03-11 16:35 ` rezso
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox