Skip to content

Commit

Permalink
Fix the version length field when saving (#51)
Browse files Browse the repository at this point in the history
We need to write the length of the aligned buffer, not the length of the version string. Discovered in icsharpcode/ILSpy#3068
  • Loading branch information
jkoritzinsky authored Jan 4, 2024
1 parent 3964b07 commit 92849ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dnmd/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ bool md_write_to_buffer(mdhandle_t handle, uint8_t* buffer, size_t* len)
size_t version_str_len = strlen(cxt->version);
uint32_t version_buf_len = align_to((uint32_t)version_str_len + 1, 4);

if (!write_u32(&buffer, &remaining_buffer_len, (uint32_t)version_str_len + 1))
if (!write_u32(&buffer, &remaining_buffer_len, (uint32_t)version_buf_len))
return false;

if (remaining_buffer_len < version_buf_len)
Expand Down

0 comments on commit 92849ce

Please sign in to comment.