From 27f66c0bcbe5f793b652c2aab3ff87bcf01e82a6 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Wed, 28 Mar 2001 04:10:24 +0000 Subject: [PATCH] * memchr.c (memchr): Adjust condition to avoid infinite loop. From-SVN: r40899 --- libiberty/ChangeLog | 4 ++++ libiberty/memchr.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 7a1e8268551..f4ec6e15c2f 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2001-03-27 Kaveh R. Ghazi + + * memchr.c (memchr): Adjust condition to avoid infinite loop. + 2001-03-23 Jakub Jelinek * cp-demangle.c (demangle_discriminator): `_0' is discriminator #1, diff --git a/libiberty/memchr.c b/libiberty/memchr.c index cce30039437..89aa98f1d94 100644 --- a/libiberty/memchr.c +++ b/libiberty/memchr.c @@ -50,7 +50,7 @@ memchr (src_void, c, length) { const unsigned char *src = (const unsigned char *)src_void; - while (--length >= 0) + while (length-- > 0) { if (*src == c) return (PTR)src; -- 2.30.2