Browse code

make parselib's field_quotedstr() terminate the result str when the field isn't recognized as a quotedstr

Dario Rodriguez authored on 14/03/2014 20:32:29
Showing 1 changed files
... ...
@@ -42,8 +42,11 @@ field_quotedstr(char *ptr, char *str, long strsize)
42 42
         int flaglit;
43 43
         while(strchr(" \t",*ptr)!=NULL)
44 44
                 ptr++;
45
-        if(*ptr!='\"')
45
+        if(*ptr!='\"') {
46
+		if(str!=NULL && strsize>0)
47
+			*str='\0';
46 48
                 return(ptr);
49
+	}
47 50
         /* skip initial '\"' */
48 51
         ptr++;
49 52
         /* read the string unescaping as we go */