From f319bb66252c6d32a0657c774534ba409567aa62 Mon Sep 17 00:00:00 2001 From: Chip Weinberger Date: Thu, 20 Oct 2022 00:27:31 -0700 Subject: [PATCH] stack corruption for long cmdline args --- src/argtable3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/argtable3.c b/src/argtable3.c index 88632a9..543afce 100644 --- a/src/argtable3.c +++ b/src/argtable3.c @@ -504,11 +504,11 @@ static void arg_cat(char** pdest, const char* src, size_t* pndest) { char* end = dest + *pndest; /*locate null terminator of dest string */ - while (dest < end && *dest != 0) + while (dest < end-1 && *dest != 0) dest++; /* concat src string to dest string */ - while (dest < end && *src != 0) + while (dest < end-1 && *src != 0) *dest++ = *src++; /* null terminate dest string */