]> Dogcows Code - chaz/openbox/commitdiff
avoid ascii control characters in strings
authorDana Jansens <danakj@orodu.net>
Wed, 24 Mar 2010 23:49:23 +0000 (19:49 -0400)
committerDana Jansens <danakj@orodu.net>
Thu, 25 Mar 2010 22:11:13 +0000 (18:11 -0400)
obt/ddfile.c

index e0c7f9863aad7e0d06fa7c2b7d7f2528cbe516a5..05c3f1dde0301d78cafbd04c52c71dc9b56b3c20 100644 (file)
@@ -96,7 +96,7 @@ static gchar* parse_string(const gchar *in, gboolean locale,
     if (!locale) {
         end = in + bytes;
         for (i = in; i < end; ++i) {
-            if (*i > 127) {
+            if (*i > 126 || *i < 32) { /* non-control character ascii */
                 end = i;
                 parse_error("Invalid bytes in string", parse, error);
                 break;
@@ -128,6 +128,10 @@ static gchar* parse_string(const gchar *in, gboolean locale,
         }
         else if (*i == '\\')
             backslash = TRUE;
+        else if (*i >= 127 || *i < 32) { /* avoid ascii control characters */
+            parse_error("Found control character in string", parse, error);
+            break;
+        }
         else {
             memcpy(o, i, next-i);
             o += next-i;
This page took 0.025495 seconds and 4 git commands to generate.