From: Moriyoshi Koizumi Date: Tue, 23 Dec 2003 11:02:26 +0000 (+0000) Subject: Fix fgetcsv()'s null line handling. X-Git-Tag: php-4.3.5RC1~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fa2ebc0f2a2dd8d655fed5a31461465af1f5984;p=php Fix fgetcsv()'s null line handling. # Thanks Takeshi Nakamura for reporting this bug. --- diff --git a/ext/standard/file.c b/ext/standard/file.c index 57790adafd..d3bee95f9b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2257,11 +2257,11 @@ PHP_FUNCTION(fgetcsv) re = e = buf + buf_len; /* strip leading spaces */ - while (isspace((int)*(unsigned char *)s) && *s != delimiter) { + while (isspace((int)*(unsigned char *)s) && *s != delimiter && s < re) { s++; } /* strip trailing spaces */ - while (isspace((int)*(unsigned char *)(--e)) && *e != delimiter); + while (e >= s && isspace((int)*(unsigned char *)(--e)) && *e != delimiter); e++; array_init(return_value);