From: Antony Dovgal Date: Mon, 18 Dec 2006 13:16:54 +0000 (+0000) Subject: MFH: fix possible invalid read (reproducible only on big-endian machines) X-Git-Tag: php-5.2.1RC2~169 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=908b1e562d5e2a586ca721e779afedb958d92067;p=php MFH: fix possible invalid read (reproducible only on big-endian machines) --- diff --git a/main/SAPI.c b/main/SAPI.c index a760ded4a8..5053c621ad 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -565,7 +565,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) header_line = estrndup(header_line, header_line_len); /* cut of trailing spaces, linefeeds and carriage-returns */ - while(isspace(header_line[header_line_len-1])) + while(header_line_len && isspace(header_line[header_line_len-1])) header_line[--header_line_len]='\0'; /* new line safety check */