Skip to content

Commit

Permalink
Merge branch 'mlundh-bufferOverrunFix'
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Feb 25, 2021
2 parents 62bba78 + 3acd6a8 commit 69c7e86
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ char *el_filename_complete(char *pathname, int *match)
if (ac == 1) {
/* Exactly one match -- finish it off. */
*match = 1;
j = strlen(av[0]) - len + 2;
p = malloc(sizeof(char) * (j + 1));
j = strlen(av[0]) - len + 1;
p = malloc(sizeof(char) * (j + 1));
if (p) {
memcpy(p, av[0] + len, j);
len = strlen(dir) + strlen(av[0]) + 2;
path = malloc(sizeof(char) * len);
len = strlen(dir) + strlen(av[0]) + 2;
path = malloc(sizeof(char) * len);
if (path) {
snprintf(path, len, "%s/%s", dir, av[0]);
snprintf(path, len, "%s/%s", dir, av[0]);
rl_add_slash(path, p);
free(path);
}
Expand Down

0 comments on commit 69c7e86

Please sign in to comment.