From 30a1def20d43b665660f606caa2dbe1c0b88b8e3 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 28 Mar 2001 05:02:47 +0000 Subject: [PATCH] merge from gcc --- libiberty/ChangeLog | 4 ++++ libiberty/memchr.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 5780bcdc383..588bd6fcb89 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