Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: falk at debian.org (Falk Hueffner)
Subject: buffer overflow in srm_env_write?!
Date: Mon, 14 Mar 2005 20:15:44 +0100	[thread overview]
Message-ID: <87hdjeujhb.fsf@debian.org> (raw)
In-Reply-To: <850F2E3B91BCD611A3FC00508B94988A0567B477@erlh908a.med.siemens.de> (Heid Oliver's message of "Mon, 14 Mar 2005 17:19:56 +0100")

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.

The real solution is not to add a newline if you don't want one to be
added. Use echo -n.

-- 
	Falk



  reply	other threads:[~2005-03-14 19:15 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 [this message]
2005-03-14 20:47   ` michal
  -- 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