Skip to content

Commit 0cf5b03

Browse files
committed
fixup! built-in add -i: implement the main loop
Whoops, a buffer overrun. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cca070d commit 0cf5b03

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

add-interactive.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ static ssize_t list_and_choose(struct add_i_state *s,
343343
}
344344
}
345345

346-
p[sep] = '\0';
346+
if (p[sep])
347+
p[sep++] = '\0';
347348
if (from < 0) {
348349
from = find_unique(p, items);
349350
if (from >= 0)
@@ -369,7 +370,7 @@ static ssize_t list_and_choose(struct add_i_state *s,
369370
res += choose ? +1 : -1;
370371
}
371372

372-
p += sep + 1;
373+
p += sep;
373374
}
374375

375376
if ((immediate && res != LIST_AND_CHOOSE_ERROR) ||

0 commit comments

Comments
 (0)