From 5ae3891ee57dd4574d923af15c0c2bf181bb7557 Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 1 Jun 2022 19:57:09 +0600 Subject: [PATCH] fix incorrect usage of sizeof `sizeof(cmd)` here would give the sizeof a char pointer, not the sizeof the cp/mv array. --- src/nnn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 1465f4ab..8500b783 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2542,7 +2542,7 @@ static bool cpmv_rename(int choice, const char *path) uint_t count = 0, lines = 0; bool ret = FALSE; char *cmd = (choice == 'c' ? cp : mv); - char buf[sizeof(patterns[P_CPMVRNM]) + sizeof(cmd) + (PATH_MAX << 1)]; + char buf[sizeof(patterns[P_CPMVRNM]) + (MAX(sizeof(cp), sizeof(mv))) + (PATH_MAX << 1)]; fd = create_tmp_file(); if (fd == -1) -- 2.48.1