From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Zumbiehl Date: Fri, 04 Sep 2009 19:34:45 +0000 Subject: [PATCH] fix buffer overflow in udev_util_replace_whitespace() Message-Id: <20090904193445.GQ4363@florz.florz.dyndns.org> List-Id: References: <20090831173335.GL4363@florz.florz.dyndns.org> In-Reply-To: <20090831173335.GL4363@florz.florz.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hi, untested, ... Florian 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; /* strip trailing whitespace */ - len = strnlen(str, len); + len = strnlen(str, len-1); while (len && isspace(str[len-1])) len--;