Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
current (nightly)
-
None
-
None
Description
Currently the generated client stub code for SetSecure is:
void Service::SetSecure( char * pszArguments, ...)
{
char ** ppszArgPtr = &pszArguments;
int iArgIndex = 0;
while( *ppszArgPtr != NULL)
{ sArguments[iArgIndex] = *ppszArgPtr; iArgIndex++; ppszArgPtr++; }}
This makes horrible assumptions about how arguments are passed to functions and which direction the stack grows and is highly non-portable.
The correct code would be:
#include <stdarg.h>
void Service::SetSecure( char * pszArguments, ...)
{
int iArgIndex = 0;
va_list args;
va_start(args, pszArguments);
while (pszArguments)
{ sArguments[iArgIndex++] = pszArguments; pszArguments = va_arg(args, char*); } va_end(args);
}