mirror of
https://github.com/jarun/nnn.git
synced 2024-11-18 00:49:15 +00:00
Fix off-by-one
This commit is contained in:
parent
1022340aa1
commit
7857b7bc5a
|
@ -5391,12 +5391,12 @@ static bool prompt_run(void)
|
||||||
|
|
||||||
cnt_J = 0;
|
cnt_J = 0;
|
||||||
next = cmdline;
|
next = cmdline;
|
||||||
while (!cnt_j && (next = strstr(next, "%J"))) {
|
while ((next = strstr(next, "%J"))) {
|
||||||
++cnt_J;
|
++cnt_J;
|
||||||
|
|
||||||
tmplen = xstrsncpy(tmpcmd, cmdline, next - cmdline + 1) - 1;
|
tmplen = xstrsncpy(tmpcmd, cmdline, next - cmdline + 1) - 1;
|
||||||
tmplen += xstrsncpy(tmpcmd + tmplen, "${0} ${@}", sizeof("${0} ${@}"));
|
tmplen += xstrsncpy(tmpcmd + tmplen, "${0} ${@}", sizeof("${0} ${@}")) - 1;
|
||||||
xstrsncpy(tmpcmd + tmplen, next + 2, len - (next - cmdline + 2));
|
xstrsncpy(tmpcmd + tmplen, next + 2, len - (next - cmdline + 2) + 1);
|
||||||
|
|
||||||
++next;
|
++next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue