diff options
Diffstat (limited to 'src/Common/Cmdline.c')
-rw-r--r-- | src/Common/Cmdline.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Common/Cmdline.c b/src/Common/Cmdline.c index 35507c2b..f1f9a8fc 100644 --- a/src/Common/Cmdline.c +++ b/src/Common/Cmdline.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "Apidrvr.h" | 20 | #include "Apidrvr.h" |
21 | #include "Dlgcode.h" | 21 | #include "Dlgcode.h" |
22 | #include "Language.h" | 22 | #include "Language.h" |
23 | #include <Strsafe.h> | ||
23 | 24 | ||
24 | /* Except in response to the WM_INITDIALOG message, the dialog box procedure | 25 | /* Except in response to the WM_INITDIALOG message, the dialog box procedure |
25 | should return nonzero if it processes the message, and zero if it does | 26 | should return nonzero if it processes the message, and zero if it does |
@@ -44,13 +45,13 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM | |||
44 | 45 | ||
45 | *tmp = 0; | 46 | *tmp = 0; |
46 | 47 | ||
47 | strcpy (tmp, "Command line options:\n\n"); | 48 | StringCbCopyA (tmp, 8192, "Command line options:\n\n"); |
48 | for (i = 0; i < as->arg_cnt; i ++) | 49 | for (i = 0; i < as->arg_cnt; i ++) |
49 | { | 50 | { |
50 | if (!as->args[i].Internal) | 51 | if (!as->args[i].Internal) |
51 | { | 52 | { |
52 | sprintf(tmp2, "%s\t%s\n", as->args[i].short_name, as->args[i].long_name); | 53 | StringCchPrintf(tmp2, MAX_PATH * 2, "%s\t%s\n", as->args[i].short_name, as->args[i].long_name); |
53 | strcat(tmp,tmp2); | 54 | StringCchCat(tmp, 8192, tmp2); |
54 | } | 55 | } |
55 | } | 56 | } |
56 | 57 | ||
@@ -220,7 +221,7 @@ int GetArgumentValue (char **lpszCommandLineArgs, int nArgPos, int *nArgIdx, | |||
220 | { | 221 | { |
221 | /* Handles the case of no space between parameter code and | 222 | /* Handles the case of no space between parameter code and |
222 | value */ | 223 | value */ |
223 | strncpy (lpszValue, &lpszCommandLineArgs[*nArgIdx][nArgPos], nValueSize); | 224 | StringCbCopyA (lpszValue, nValueSize, &lpszCommandLineArgs[*nArgIdx][nArgPos]); |
224 | lpszValue[nValueSize - 1] = 0; | 225 | lpszValue[nValueSize - 1] = 0; |
225 | return HAS_ARGUMENT; | 226 | return HAS_ARGUMENT; |
226 | } | 227 | } |
@@ -231,7 +232,7 @@ int GetArgumentValue (char **lpszCommandLineArgs, int nArgPos, int *nArgIdx, | |||
231 | { | 232 | { |
232 | /* Handles the case of space between parameter code | 233 | /* Handles the case of space between parameter code |
233 | and value */ | 234 | and value */ |
234 | strncpy (lpszValue, &lpszCommandLineArgs[*nArgIdx + 1][x], nValueSize); | 235 | StringCbCopyA (lpszValue, nValueSize, &lpszCommandLineArgs[*nArgIdx + 1][x]); |
235 | lpszValue[nValueSize - 1] = 0; | 236 | lpszValue[nValueSize - 1] = 0; |
236 | (*nArgIdx)++; | 237 | (*nArgIdx)++; |
237 | return HAS_ARGUMENT; | 238 | return HAS_ARGUMENT; |