From: Wolf Vollprecht Date: Sat, 8 Jan 2022 16:10:52 +0000 (+0100) Subject: check that malloc succeeds and use safe strcpy/strcat X-Git-Tag: archive/raspbian/1.2.1+ds1-1+rpi1^2~7^2~1^2~10^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=911a55f32cbc594b8f6061dcf6828371bae80e2a;p=zchunk.git check that malloc succeeds and use safe strcpy/strcat --- 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