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: Incorrect pointer arithmetics in ucl_expand_single_variable #221

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Incorrect pointer arithmetics in ucl_expand_single_variable
This one I'm not 100% sure, but other code paths in that function are doing it this way.

As I said in previous issue, I had UclObjects holding bytes related to previous allocations. I *think* it's related to this code block. Valgrind showed read/write problems related to those pointers as well.

Hopefully this is last PR for this function.
  • Loading branch information
andoriyu committed Apr 12, 2020
commit e7c50d47f34441191c760bb49f6223908f666efb
4 changes: 2 additions & 2 deletions src/ucl_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ ucl_expand_single_variable (struct ucl_parser *parser, const char *ptr,
if (parser->var_handler (p, remain, &dst, &dstlen, &need_free,
parser->var_data)) {
memcpy (d, dst, dstlen);
ret += dstlen;
d += remain;
ret += remain;
d += dstlen;
found = true;
if (need_free) {
free (dst);
Expand Down