Skip to content

Commit

Permalink
Fix string buffer overflow
Browse files Browse the repository at this point in the history
Fixes #101
  • Loading branch information
terrybrash committed Oct 20, 2018
1 parent 6ab4fd8 commit d191908
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/localization.cc
Expand Up @@ -175,11 +175,11 @@ get_localized_string(int id)
size_t len = strlen(name) + strlen(spacer) + strlen(cmd) + 2 /*[]*/+ 1/*\n*/;
char* with_cmd = (char*)mlt_calloc(len, 1, "Strings");

strncat(with_cmd, name, strlen(name));
strncat(with_cmd, spacer, strlen(spacer));
strncat(with_cmd, "[", 1);
strncat(with_cmd, cmd, strlen(cmd));
strncat(with_cmd, "]", 1);
strncat(with_cmd, name, len - 1);
strncat(with_cmd, spacer, len - strlen(with_cmd) - 1);
strncat(with_cmd, "[", len - strlen(with_cmd) - 1);
strncat(with_cmd, cmd, len - strlen(with_cmd) - 1);
strncat(with_cmd, "]", len - strlen(with_cmd) - 1);

g_baked_strings_with_commands[id] = with_cmd;
}
Expand Down

0 comments on commit d191908

Please sign in to comment.