Skip to content

Commit

Permalink
lib-managesieve: Make sure str_unescape() won't be writing past alloc…
Browse files Browse the repository at this point in the history
…ated memory

The previous commit should already prevent this, but this makes sure it
can't become broken in the future either. It makes the performance a tiny
bit worse, but that's not practically noticeable.
  • Loading branch information
sirainen authored and cmouse committed Aug 23, 2019
1 parent 7ce9990 commit 4a29984
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib-managesieve/managesieve-parser.c
Expand Up @@ -169,10 +169,8 @@ static void managesieve_parser_save_arg(struct managesieve_parser *parser,

/* remove the escapes */
if (parser->str_first_escape >= 0 &&
(parser->flags & MANAGESIEVE_PARSE_FLAG_NO_UNESCAPE) == 0) {
/* -1 because we skipped the '"' prefix */
str_unescape(str + parser->str_first_escape-1);
}
(parser->flags & MANAGESIEVE_PARSE_FLAG_NO_UNESCAPE) == 0)
(void)str_unescape(str);

arg->_data.str = str;
arg->str_len = strlen(str);
Expand Down

0 comments on commit 4a29984

Please sign in to comment.