]> granicus.if.org Git - json-c/commitdiff
escape '\f' in json_escape_str
authorAbioy <abioy.sun@gmail.com>
Mon, 24 Dec 2012 14:22:05 +0000 (22:22 +0800)
committerAbioy <abioy.sun@gmail.com>
Mon, 24 Dec 2012 14:22:05 +0000 (22:22 +0800)
'\f' is a llegal char and should be escape in printbuf

json_object.c

index a84785cd88e6e068a95b2857e4667ecd9f90e1f5..6060554a7c86b7835402c7b68ae3b913a4db8a5e 100644 (file)
@@ -98,6 +98,7 @@ static int json_escape_str(struct printbuf *pb, char *str, int len)
     case '\n':
     case '\r':
     case '\t':
+    case '\f':
     case '"':
     case '\\':
     case '/':
@@ -107,6 +108,7 @@ static int json_escape_str(struct printbuf *pb, char *str, int len)
       else if(c == '\n') printbuf_memappend(pb, "\\n", 2);
       else if(c == '\r') printbuf_memappend(pb, "\\r", 2);
       else if(c == '\t') printbuf_memappend(pb, "\\t", 2);
+      else if(c == '\f') printbuf_memappend(pb, "\\f", 2);
       else if(c == '"') printbuf_memappend(pb, "\\\"", 2);
       else if(c == '\\') printbuf_memappend(pb, "\\\\", 2);
       else if(c == '/') printbuf_memappend(pb, "\\/", 2);