Really fix check for maximal argument number in wxPrintf().

Increment nargs before comparing it with wxMAX_SVNPRINTF_ARGUMENTS, if the
comparison is true for the post increment, the value is already invalid.
This commit is contained in:
Vadim Zeitlin
2015-05-24 02:47:00 +02:00
parent 5a9ce576a2
commit d07c4cb826

View File

@@ -838,7 +838,7 @@ struct wxPrintfConvSpecParser
for ( unsigned n = 0; n < numAsterisks; n++ ) for ( unsigned n = 0; n < numAsterisks; n++ )
{ {
if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS ) if ( ++nargs == wxMAX_SVNPRINTF_ARGUMENTS )
break; break;
// TODO: we need to support specifiers of the form "%2$*1$s" // TODO: we need to support specifiers of the form "%2$*1$s"
@@ -895,7 +895,7 @@ struct wxPrintfConvSpecParser
// this conversion specifier is tied to the pos-th argument... // this conversion specifier is tied to the pos-th argument...
pspec[spec->m_pos] = spec; pspec[spec->m_pos] = spec;
if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS ) if ( ++nargs == wxMAX_SVNPRINTF_ARGUMENTS )
break; break;
} }