axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Nordberg (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-921) WhatAmI returns reference to local store
Date Sat, 04 Feb 2006 00:34:03 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-921?page=comments#action_12365155 ] 

Henrik Nordberg commented on AXISCPP-921:
-----------------------------------------

These functions don't appear to be called from within the Axis-C++ source code. Maybe we can
remove them, or return a heap pointer instead of a stack pointer?

> 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