summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-03-24 19:49:23 -0400
committerDana Jansens <danakj@orodu.net>2010-03-25 18:11:13 -0400
commit4968f7c62a3c072eb98702813b870a9aab58144d (patch)
tree9a9dc376f8a1a5e935ec04facb4b2fc60cc52821
parent70e819a905bd3b80053e3c90c6459d2b9e0b893c (diff)
avoid ascii control characters in strings
-rw-r--r--obt/ddfile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/obt/ddfile.c b/obt/ddfile.c
index e0c7f986..05c3f1dd 100644
--- a/obt/ddfile.c
+++ b/obt/ddfile.c
@@ -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;