From 22dec4892c6d45f748b80b890b1d32c6c8608aca Mon Sep 17 00:00:00 2001 From: hooper114 Date: Thu, 6 Aug 2009 08:53:05 +0000 Subject: [PATCH] Extra \0 in preprocessed makes string too long --- backend/png.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/png.c b/backend/png.c index fb3e6a52..86cd6ec1 100644 --- a/backend/png.c +++ b/backend/png.c @@ -447,7 +447,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[]) j = 0; i = 0; next = 0; - do { + while (i < input_length) { if(source[i] < 128) { preprocessed[j] = source[i]; j++; @@ -465,7 +465,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[]) } } i = next; - } while(i < input_length); + } preprocessed[j] = '\0'; return;