Skip to content

Commit 1d32ba2

Browse files
committed
fix mrc_str_escape bug
1 parent 1c44b7b commit 1d32ba2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cdump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ mrc_str_escape(mrc_ccontext *c, mrc_string *s)
108108
mrc_str_cat_lit(c, s2, "\"");
109109
if (s2) {
110110
for (size_t i=0; i<s->len; i++) {
111-
char ch = s->ptr[i];
112-
if (ch == '"' || ch == '\\') {
111+
char ch[2] = {s->ptr[i], '\0'};
112+
if (ch[0] == '"' || ch[0] == '\\') {
113113
mrc_str_cat_lit(c, s2, "\\");
114114
}
115-
mrc_str_cat_lit(c, s2, &ch);
115+
mrc_str_cat_lit(c, s2, ch);
116116
}
117117
}
118118
mrc_str_cat_lit(c, s2, "\"");

0 commit comments

Comments
 (0)