Skip to content
Snippets Groups Projects
Commit f8da1dfa authored by Michael Tüxen's avatar Michael Tüxen
Browse files

When unescaping a string, the last zero byte from the input string must be

copied to the output string. The space required for that extra byte must also be
allocated.

Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@redhat.com>
parent 010a5f99
No related branches found
No related tags found
No related merge requests found
......@@ -266,7 +266,7 @@ char *flags_to_string(struct flag_name *flags_array, u64 flags)
static int unescape_cstring_expression(const char *input_string,
struct expression *out, char **error)
{
int bytes = strlen(input_string);
int bytes = strlen(input_string) + 1;
out->type = EXPR_STRING;
out->value.string = (char *)malloc(bytes);
const char *c_in = input_string;
......@@ -305,6 +305,7 @@ static int unescape_cstring_expression(const char *input_string,
++c_in;
++c_out;
}
*c_out = *c_in;
return STATUS_OK;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment