From: Ilia Alshanetsky Date: Sun, 18 Aug 2002 06:55:32 +0000 (+0000) Subject: Fixed a segmentation fault that would occur if an entry contained a X-Git-Tag: RELEASE_0_91~405 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d42dbfce8ede546cf77acdaf47b4e19905790205;p=php Fixed a segmentation fault that would occur if an entry contained a non-terminated enclosure. Bug #12556 --- diff --git a/ext/standard/file.c b/ext/standard/file.c index 80de164ab8..9beefa6c79 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1991,8 +1991,14 @@ PHP_FUNCTION(fgetcsv) while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++; /* 2. Read field, leaving bptr pointing at start of next field */ if (enclosure && *bptr == enclosure) { + bptr++; /* move on to first character in field */ + + /* Check if there is an end to the enclosure */ + if( !strchr(bptr, enclosure) ) { + continue; + } + /* 2A. handle enclosure delimited field */ - bptr++; /* move on to first character in field */ while (*bptr) { if (*bptr == enclosure) { /* handle the enclosure */