From mboxrd@z Thu Jan 1 00:00:00 1970 From: falk at debian.org (Falk Hueffner) Date: Mon, 14 Mar 2005 20:15:44 +0100 Subject: buffer overflow in srm_env_write?! In-Reply-To: <850F2E3B91BCD611A3FC00508B94988A0567B477@erlh908a.med.siemens.de> (Heid Oliver's message of "Mon, 14 Mar 2005 17:19:56 +0100") References: <850F2E3B91BCD611A3FC00508B94988A0567B477@erlh908a.med.siemens.de> Message-ID: <87hdjeujhb.fsf@debian.org> Heid Oliver 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