Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memory size to store safely the '\0' after the string #23

Merged
merged 1 commit into from
Sep 2, 2022
Merged

fix memory size to store safely the '\0' after the string #23

merged 1 commit into from
Sep 2, 2022

Conversation

gvollant
Copy link
Contributor

@gvollant gvollant commented Sep 1, 2022

The _parse_data_SAX alloc a buffer of size strlen(line) for before calling html2str.

html2str create a string with same length of line (or smaller) BUT add a '\0' after the string.

So we need add a +1 on the malloc to avoid valgrind or address sanitizer report or... crash!

@matthieu-labas
Copy link
Owner

Good catch! I guess it happens when there are not HTML codes to escape.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants