nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7857b7bc5af3eda3f11bd448e63618762ff97cbc
parent 1022340aa15b39a4a3543c89a4e1f49d898c0e41
Author: KlzXS <klzx+github@klzx.cf>
Date:   Fri, 22 Oct 2021 21:06:26 +0200

Fix off-by-one

Diffstat:
Msrc/nnn.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/nnn.c b/src/nnn.c @@ -5391,12 +5391,12 @@ static bool prompt_run(void) cnt_J = 0; next = cmdline; - while (!cnt_j && (next = strstr(next, "%J"))) { + while ((next = strstr(next, "%J"))) { ++cnt_J; tmplen = xstrsncpy(tmpcmd, cmdline, next - cmdline + 1) - 1; - tmplen += xstrsncpy(tmpcmd + tmplen, "${0} ${@}", sizeof("${0} ${@}")); - xstrsncpy(tmpcmd + tmplen, next + 2, len - (next - cmdline + 2)); + tmplen += xstrsncpy(tmpcmd + tmplen, "${0} ${@}", sizeof("${0} ${@}")) - 1; + xstrsncpy(tmpcmd + tmplen, next + 2, len - (next - cmdline + 2) + 1); ++next; }