Skip to content

Commit 4bb7f32

Browse files
committed
add-interactive: reject malformed numerical input
The list-and-choose interface accepts malformed input such as "2m3" and interprets it as "2-", silently selecting a range to the end. This is misleading and makes it easy to select unintended items. Reject such input by treating it as invalid. Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
1 parent 6ad8021 commit 4bb7f32

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

add-interactive.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ static ssize_t list_and_choose(struct add_i_state *s,
396396
if (endp != p + sep)
397397
from = -1;
398398
}
399+
else
400+
from = -1;
399401
}
400402

401403
if (p[sep])

0 commit comments

Comments
 (0)