Skip to content

Commit

Permalink
fix: don't copy to null heredoc delimiters
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Apr 11, 2024
1 parent 1970efe commit f8fb327
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ static void deserialize(Scanner *scanner, const char *buffer, unsigned length) {
size += sizeof(uint32_t);
array_reserve(&heredoc->delimiter, heredoc->delimiter.size);

memcpy(heredoc->delimiter.contents, &buffer[size], heredoc->delimiter.size);
size += heredoc->delimiter.size;
if (heredoc->delimiter.size > 0) {
memcpy(heredoc->delimiter.contents, &buffer[size], heredoc->delimiter.size);
size += heredoc->delimiter.size;
}
}
assert(size == length);
}
Expand Down

0 comments on commit f8fb327

Please sign in to comment.