[NTVDM] Use strsafe functions for concantenation of strings in otvdm code. (#4124)
authorDoug Lyons <douglyons@douglyons.com>
Thu, 25 Nov 2021 20:06:05 +0000 (14:06 -0600)
committerGitHub <noreply@github.com>
Thu, 25 Nov 2021 20:06:05 +0000 (21:06 +0100)
subsystems/mvdm/ntvdm/dos/dos32krnl/process.c

index 4924676..aa5680d 100644 (file)
@@ -13,6 +13,7 @@
 
 #define NDEBUG
 #include <debug.h>
+#include <strsafe.h>
 
 #include "emulator.h"
 #include "cpu/cpu.h"
@@ -803,9 +804,9 @@ WORD DosCreateProcess(IN LPCSTR ProgramName,
             CHAR ExpName[MAX_PATH];
 
             ExpandEnvironmentStringsA(AppName, ExpName, ARRAYSIZE(ExpName) - 1);
-            strcat(ExpName, "\"");         // Add double-quote before ProgramName
-            strcat(ExpName, ProgramName);  // Append Program name
-            strcat(ExpName, "\"");         // Add double-quote after ProgramName
+            StringCbCatA(ExpName, sizeof(ExpName), "\"");         // Add double-quote before ProgramName
+            StringCbCatA(ExpName, sizeof(ExpName), ProgramName);  // Append Program name
+            StringCbCatA(ExpName, sizeof(ExpName), "\"");         // Add double-quote after ProgramName
 
             ZeroMemory(&pi, sizeof(pi));
             ZeroMemory(&si, sizeof(si));