]> granicus.if.org Git - php/commitdiff
Fixed a segmentation fault that would occur if an entry contained a
authorIlia Alshanetsky <iliaa@php.net>
Sun, 18 Aug 2002 06:55:32 +0000 (06:55 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 18 Aug 2002 06:55:32 +0000 (06:55 +0000)
non-terminated enclosure. Bug #12556

ext/standard/file.c

index 80de164ab88ea198a0fb02e6d0cc4214474513d8..9beefa6c79764d3ce54e8de307291ea0129603f7 100644 (file)
@@ -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 */