From 70076bf624cc9b887de8a7b8a22e6207e93fdec6 Mon Sep 17 00:00:00 2001 From: Andreas Bergmeier Date: Sun, 21 Jun 2020 21:31:05 +0200 Subject: [PATCH 1/2] Fix invalid check found by PVS Studio Was V501 at https://www.viva64.com/en/b/0741/ --- REDALERT/CONQUER.CPP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REDALERT/CONQUER.CPP b/REDALERT/CONQUER.CPP index 1262c2f59..78cc842bd 100644 --- a/REDALERT/CONQUER.CPP +++ b/REDALERT/CONQUER.CPP @@ -5573,7 +5573,7 @@ void Shake_The_Screen(int shakes, HousesType house) *=============================================================================================*/ void List_Copy(short const * source, int len, short * dest) { - if (dest == NULL || dest == NULL) { + if (source == NULL || dest == NULL) { return; } From 8d6422e1b287c42d41a5d80e46755bd1a3ab49ef Mon Sep 17 00:00:00 2001 From: Andreas Bergmeier Date: Sun, 21 Jun 2020 21:36:59 +0200 Subject: [PATCH 2/2] Fix overflow found by PVS Studio Was V512 at https://www.viva64.com/en/b/0741/ --- TIBERIANDAWN/SOUNDDLG.CPP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TIBERIANDAWN/SOUNDDLG.CPP b/TIBERIANDAWN/SOUNDDLG.CPP index 838f0caa8..3b951d9f4 100644 --- a/TIBERIANDAWN/SOUNDDLG.CPP +++ b/TIBERIANDAWN/SOUNDDLG.CPP @@ -245,7 +245,7 @@ void SoundControlsClass::Process(void) int length = Theme.Track_Length(index); char const * fullname = Theme.Full_Name(index); - void * ptr = new char [sizeof(100)]; + void * ptr = new char [100]; if (ptr) { sprintf((char *)ptr, "%cTrack %d\t%d:%02d\t%s", index, listbox.Count()+1, length / 60, length % 60, fullname); listbox.Add_Item((char const *)ptr);