]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Improve escape handling in json parser.
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 19 Jun 2012 10:28:04 +0000 (11:28 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 19 Jun 2012 10:28:04 +0000 (11:28 +0100)
src/htsmsg_json.c

index a302247dc8a6c4260a767d417a57eec6d41d7025..ff1aa6f7bcaff432d70b640b3df5b0427bc87e59 100644 (file)
@@ -164,7 +164,11 @@ htsmsg_json_parse_string(const char *s, const char **endp)
 
     if(*s == '\\') {
       esc = 1;
-    } else if(*s == '"' && s[-1] != '\\') {
+      /* skip the escape */
+      s++;
+      if (*s == 'u') s += 4;
+      // Note: we could detect the lack of support here!
+    } else if(*s == '"') {
 
       *endp = s + 1;
 
@@ -184,6 +188,8 @@ htsmsg_json_parse_string(const char *s, const char **endp)
            a++;
            if(*a == 'b')
              *b++ = '\b';
+      else if(*a == '\\')
+        *b++ = '\\';
            else if(*a == 'f')
              *b++ = '\f';
            else if(*a == 'n')