nnn

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

commit 8fe47610922a37896999d50151ec39cc293ba75e
parent 2a4008c9ab7edbbcf65fc9a05ea4fd7b2ea0a022
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Thu, 25 Jul 2019 19:55:55 +0530

Fix #301 - use local buffer to avoid overwriting g_buf

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

diff --git a/src/nnn.c b/src/nnn.c @@ -1265,14 +1265,16 @@ finish: static void archive_selection(const char *cmd, const char *archive, const char *curpath) { - snprintf(g_buf, CMD_LEN_MAX, + char *buf = (char *)malloc(CMD_LEN_MAX * sizeof(char)); + snprintf(buf, CMD_LEN_MAX, #ifdef __linux__ "xargs -0 -a %s %s %s", #else "cat %s | xargs -0 -o %s %s", #endif g_cppath, cmd, archive); - spawn("sh", "-c", g_buf, curpath, F_NORMAL); + spawn("sh", "-c", buf, curpath, F_NORMAL); + free(buf); } static bool write_lastdir(const char *curpath)