diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-07-25 19:55:55 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-07-25 20:02:54 +0530 |
commit | 8fe47610922a37896999d50151ec39cc293ba75e (patch) | |
tree | fe05301c0e4063476acf00359933ac7a7475e8d0 /src | |
parent | 2a4008c9ab7edbbcf65fc9a05ea4fd7b2ea0a022 (diff) | |
download | nnn-8fe47610922a37896999d50151ec39cc293ba75e.tar.gz |
Fix #301 - use local buffer to avoid overwriting g_buf
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) |