axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emanuel Norrbin (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-921) WhatAmI returns reference to local store
Date Thu, 26 Jan 2006 19:36:11 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-921?page=comments#action_12364123 ] 

Emanuel Norrbin commented on AXISCPP-921:
-----------------------------------------

I was looking at the wrong source tree but this issue also exists in svn revision 372576.

Also the definition of  char szInfo[64] should be inside the #ifdef WIN32 block
since it is only used on Win32 platforms.

/Emanuel


> WhatAmI returns reference to local store
> ----------------------------------------
>
>          Key: AXISCPP-921
>          URL: http://issues.apache.org/jira/browse/AXISCPP-921
>      Project: Axis-C++
>         Type: Bug
>   Components: Transport (axis3)
>     Versions:  1.6 Final
>  Environment: All platforms, Issue found in nightly drop 24-Jan-2006 21:23
>     Reporter: Emanuel Norrbin

>
> File: transport\axis3\HTTPTransportInstantiator.cpp
> Method: const char * WhatAmI()
> Line: 79 - 94
> The method below returns a reference to the locally allocated string szWhatAmI[256],
> if a char* is to be returned it has to be allocated globally or the program might crash
> when this memory is acessed by the caller.
>    STORAGE_CLASS_INFO const char * WhatAmI()
> 	{
> 		char			szInfo[64];
> 		char			szWhatAmI[256];
> 		const char *	pszWhatAmI = szWhatAmI;   //** Local store
> 		memset( szInfo, 0, sizeof( szInfo));
> 		memset( szWhatAmI, 0, sizeof( szWhatAmI));
> 		strcpy( szWhatAmI, "LibraryName: HTTPTransport\n");
> #ifdef WIN32
> 		sprintf( szInfo, "Built: %s\n", __TIMESTAMP__);
> 		strcat( szWhatAmI, szInfo);
> #endif
> 		return pszWhatAmI;  //** Returns reference to local store!!
> 	}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message