From: Vadim Zeitlin Date: Thu, 20 Aug 2009 00:44:11 +0000 (+0000) Subject: Fix extraction of standard command line arguments in wxX11. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/995a95737ac42a180c246f04ba36ea7321ded64f Fix extraction of standard command line arguments in wxX11. The original number of arguments should be used when checking the argument index for validity. Additionally, memmove() wasn't moving the correct number of bytes because of forgotten sizeof(). See #11124. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/x11/app.cpp b/src/x11/app.cpp index d2b9c0b3bf..e9c7b2bb17 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -100,7 +100,7 @@ bool wxApp::Initialize(int& argC, wxChar **argV) { if (wxStrcmp( argV[i], wxT("-display") ) == 0) { - if (i < (argC - 1)) + if (i < (argCOrig - 1)) { argV[i++] = NULL; @@ -112,7 +112,7 @@ bool wxApp::Initialize(int& argC, wxChar **argV) } else if (wxStrcmp( argV[i], wxT("-geometry") ) == 0) { - if (i < (argC - 1)) + if (i < (argCOrig - 1)) { argV[i++] = NULL; @@ -149,12 +149,12 @@ bool wxApp::Initialize(int& argC, wxChar **argV) if ( argC != argCOrig ) { - // remove the argumens we consumed + // remove the arguments we consumed for ( int i = 0; i < argC; i++ ) { while ( !argV[i] ) { - memmove(argV + i, argV + i + 1, argCOrig - i); + memmove(argV + i, argV + i + 1, (argCOrig - i)*sizeof(wxChar *)); } } }