notaz.gp2x.de
/
ia32rtools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c8fb369
)
cvt_data: fix escape chars
author
notaz
<notasas@gmail.com>
Sat, 20 Jun 2015 00:48:43 +0000
(
03:48
+0300)
committer
notaz
<notasas@gmail.com>
Sat, 20 Jun 2015 00:48:43 +0000
(
03:48
+0300)
tools/cvt_data.c
patch
|
blob
|
blame
|
history
diff --git
a/tools/cvt_data.c
b/tools/cvt_data.c
index
93c5fd0
..
09e7ebc
100644
(file)
--- a/
tools/cvt_data.c
+++ b/
tools/cvt_data.c
@@
-195,7
+195,7
@@
static char *escape_string(char *s)
for (; *s != 0; s++) {
if (*s == '"') {
for (; *s != 0; s++) {
if (*s == '"') {
- strcpy(t, "\\
x22
");
+ strcpy(t, "\\
\"
");
t += strlen(t);
continue;
}
t += strlen(t);
continue;
}
@@
-206,7
+206,9
@@
static char *escape_string(char *s)
}
*t++ = *s;
}
}
*t++ = *s;
}
- *t = *s;
+ *t++ = *s;
+ if (t - buf > sizeof(buf))
+ aerr("string is too long\n");
return strcpy(s, buf);
}
return strcpy(s, buf);
}
@@
-691,7
+693,9
@@
int main(int argc, char *argv[])
val = parse_number(words[w]);
if (val & ~0xff)
aerr("bad string trailing byte?\n");
val = parse_number(words[w]);
if (val & ~0xff)
aerr("bad string trailing byte?\n");
- fprintf(fout, "\\x%02lx", val);
+ // unfortunately \xHH is unusable - gas interprets
+ // things like \x27b as 0x7b, so have to use octal here
+ fprintf(fout, "\\%03lo", val);
}
}
fprintf(fout, "\"");
}
}
fprintf(fout, "\"");