From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Sat, 05 Sep 2009 03:19:52 +0000 Subject: Re: [PATCH] fix buffer overflow in udev_util_replace_whitespace() Message-Id: <200909050719.55784.arvidjaar@mail.ru> MIME-Version: 1 Content-Type: multipart/mixed; boundary="nextPart2292594.kNeQlyJV3k" List-Id: References: <20090831173335.GL4363@florz.florz.dyndns.org> In-Reply-To: <20090831173335.GL4363@florz.florz.dyndns.org> To: linux-hotplug@vger.kernel.org --nextPart2292594.kNeQlyJV3k Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Friday 04 of September 2009 23:34:45 Florian Zumbiehl wrote: > Hi, >=20 > untested, ... >=20 > Florian >=20 > diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c > index 9a141db..a2aef84 100644 > --- a/libudev/libudev-util.c > +++ b/libudev/libudev-util.c > @@ -355,7 +355,7 @@ int udev_util_replace_whitespace(const char *str, > char *to, size_t len) size_t i, j; >=20 > /* strip trailing whitespace */ > - len =3D strnlen(str, len); > + len =3D strnlen(str, len-1); > while (len && isspace(str[len-1])) > len--; >=20 wrong. Please try to understand what this loop does. --nextPart2292594.kNeQlyJV3k Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEABECAAYFAkqh2NgACgkQR6LMutpd94xVaACeO/pgRyI++x9cCvXecz8ozGSE N3YAoMvfXD59+mWVjo4zgcwKpUORtfAj =mX31 -----END PGP SIGNATURE----- --nextPart2292594.kNeQlyJV3k--