From: NRK Date: Wed, 24 Nov 2021 15:53:11 +0000 (+0600) Subject: fix the malloc size in get_archive_cmd X-Git-Tag: v4.5~54^2~2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f7091f78e5e068ca4b73b34882ca402d041cb2c6;p=nnn.git fix the malloc size in get_archive_cmd since the tr hack was removed in deead97, the format string is no longer 70 chars. also removes unnecessary malloc casting. --- diff --git a/src/nnn.c b/src/nnn.c index 1c12e1cd..bd342362 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2721,9 +2721,9 @@ static void get_archive_cmd(char *cmd, const char *archive) static void archive_selection(const char *cmd, const char *archive, const char *curpath) { - /* The 70 comes from the string below */ - char *buf = (char *)malloc((70 + xstrlen(cmd) + xstrlen(archive) - + xstrlen(curpath) + xstrlen(selpath)) * sizeof(char)); + /* The 38 comes from the format string below */ + char *buf = malloc((38 + xstrlen(cmd) + xstrlen(archive) + + xstrlen(curpath) + xstrlen(selpath)) * sizeof(char)); if (!buf) { DPRINTF_S(strerror(errno)); printwarn(NULL);