X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4946a942d77cf51e00aa56404756e124d7c11411..8ae4f08661d7b324d5cd7aa16ab1a7b2810d94f2:/src/png/pngerror.c diff --git a/src/png/pngerror.c b/src/png/pngerror.c index e6c197357f..3dd1dae014 100644 --- a/src/png/pngerror.c +++ b/src/png/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * libpng 1.2.4 - July 8, 2002 + * libpng 1.2.5rc3 - September 18, 2002 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2002 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -109,6 +109,14 @@ static PNG_CONST char png_digit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; +static size_t wxstrnlen( const char *s, size_t maxlen ) +{ + size_t i ; + for ( i = 0 ; s[i] && i < maxlen ; ++i ) + ; + return i ; +} + static void /* PRIVATE */ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp error_message) @@ -117,7 +125,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp while (iin < 4) { - int c = png_ptr->chunk_name[iin++]; + int c = png_ptr->chunk_name[iin++]; if (isnonalpha(c)) { buffer[iout++] = '['; @@ -135,10 +143,12 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp buffer[iout] = 0; else { + int len = wxstrnlen(error_message, 64); + buffer[iout++] = ':'; buffer[iout++] = ' '; - png_memcpy(buffer+iout, error_message, 64); - buffer[iout+63] = 0; + png_memcpy(buffer+iout, error_message, len); + buffer[iout+len-1] = 0; } }