From ce76957a10070c132a8adfbe2e7d3f12395b4caa Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 16 Aug 2016 04:04:31 +0200 Subject: Windows: Fix various issues detected by static analysis. --- src/Format/Tcformat.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/Format') diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 31140fd7..66ec3ac3 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -9206,17 +9206,19 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { wchar_t szTmp [TC_MAX_PATH + 8000] = {0}; - GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)); - - if (wcslen (szTmp) < 1) + if ((HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))) + && (wcslen (szTmp) >= 1) + ) + { + memset (szFileName, 0, sizeof (szFileName)); + StringCbCopyW (szFileName, sizeof (szFileName), szTmp); + DirectNonSysInplaceDecStartMode = TRUE; + } + else { // No valid volume path specified as command-line parameter AbortProcess ("ERR_PARAMETER_INCORRECT"); } - - memset (szFileName, 0, sizeof (szFileName)); - StringCbCopyW (szFileName, sizeof (szFileName), szTmp); - DirectNonSysInplaceDecStartMode = TRUE; } break; -- cgit v1.2.3