From: Abioy Date: Mon, 24 Dec 2012 14:22:05 +0000 (+0800) Subject: escape '\f' in json_escape_str X-Git-Tag: json-c-0.11-20130402~22^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F58%2Fhead;p=thirdparty%2Fjson-c.git escape '\f' in json_escape_str '\f' is a llegal char and should be escape in printbuf --- diff --git a/json_object.c b/json_object.c index a84785cd..6060554a 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);