Skip to content

Commit

Permalink
Fixed a critical off-by-one error in argument handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rstemmer committed Sep 16, 2022
1 parent 64a3df5 commit 49fcaf9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2.1.3 - Print a more helpful error message when a frame shall be set but no tag exists and --create was not given as argument
- Fixed a critical off-by-one error in argument handling
2.1.2 - Memory leak in crc interface fixed
2.1.1 - Do not append padding bytes at the end of the file
2.1.0 - Partial support for extended header: remove (--rm-exthdr) and add checksum (--add-crc)
Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,8 @@ int CopyArgument(char **dst, char *src)
if(*dst != NULL)
return -1;

size_t length = strlen(src);
*dst = malloc(sizeof(char)*length+1); // +1 for the \0
size_t length = strlen(src) + 1; // +1 for the \0
*dst = malloc(sizeof(char)*length);
if(*dst == NULL)
{
fprintf(stderr, "%s, %i: ", __FILE__, __LINE__);
Expand Down

0 comments on commit 49fcaf9

Please sign in to comment.