From 911a55f32cbc594b8f6061dcf6828371bae80e2a Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Sat, 8 Jan 2022 17:10:52 +0100 Subject: [PATCH] check that malloc succeeds and use safe strcpy/strcat --- test/shacheck.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/shacheck.c b/test/shacheck.c index 48f922f..68a1446 100644 --- a/test/shacheck.c +++ b/test/shacheck.c @@ -68,11 +68,16 @@ int main (int argc, char *argv[]) { int status; #ifdef _WIN32 char* fullcmd = malloc(2000); - strcpy(fullcmd, args[0]); + if (!fullcmd) + { + printf("Unable to allocate 2000 bytes\n"); + exit(1); + } + strcpy_s(fullcmd, 2000, args[0]); for(int i=1; i