From 7eaa849e9a386da30a05d41ef77e4d047897e80a Mon Sep 17 00:00:00 2001 From: Abioy Date: Mon, 24 Dec 2012 22:22:05 +0800 Subject: [PATCH] escape '\f' in json_escape_str '\f' is a llegal char and should be escape in printbuf --- json_object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/json_object.c b/json_object.c index a84785c..6060554 100644 --- a/json_object.c +++ b/json_object.c @@ -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); -- 2.49.0