Skip to content

Commit

Permalink
Fix buffer-overflow bug in oif_util_str_duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kabanov committed Dec 9, 2024
1 parent 4175b15 commit 94540e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion oif/lang_c/oif_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ char *
oif_util_str_duplicate(const char *src)
{
size_t len = strlen(src);
char *dest = malloc(len * sizeof(*dest));
char *dest = malloc((len + 1) * sizeof(*dest));
if (dest == NULL) {
fprintf(stderr, "[str_duplicate] Could not allocate memory\n");
return NULL;
Expand Down

0 comments on commit 94540e7

Please sign in to comment.