Skip to content

Commit

Permalink
fixup! built-in add -i: implement the main loop
Browse files Browse the repository at this point in the history
Whoops, a buffer overrun.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Nov 14, 2019
1 parent cca070d commit 0cf5b03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ static ssize_t list_and_choose(struct add_i_state *s,
}
}

p[sep] = '\0';
if (p[sep])
p[sep++] = '\0';
if (from < 0) {
from = find_unique(p, items);
if (from >= 0)
Expand All @@ -369,7 +370,7 @@ static ssize_t list_and_choose(struct add_i_state *s,
res += choose ? +1 : -1;
}

p += sep + 1;
p += sep;
}

if ((immediate && res != LIST_AND_CHOOSE_ERROR) ||
Expand Down

0 comments on commit 0cf5b03

Please sign in to comment.