Bug on function SampleUtil_getFirstDocumentItem(...)

"David Zufferey" <[email protected]> Thu, 05 Jun 2003 15:46:55 +0200
Newsgroups gmane.linux.upnp-sdk.general
Message-ID <[email protected]>
Hello 

I have found a bug on the function SampleUtil_getFirstDocumentItem (SampleUtil.c). If you send accidentliy a action with a parameter and this parameter is null, there is a crash on the device application.

The function SampleUtil_getFirstDocumentItem is used to retreive on the device application, the value of the parameter in the SOAP action. The return of this value is made with this line:

 ret = strdup( ixmlNode_getNodeValue( textNode ) );
...

return ret;

The function ixmlNode_getNodeValue return a char pointer, and strdup it make a copy of this pointer. But if the pointer is null, it take a error and crash the application. To correct this I have remove strdup.

 ret = ixmlNode_getNodeValue( textNode ) ;

This error is also present in this function:

SampleUtil_GetElementValue
SampleUtil_GetFirstDocumentItem(IXML_Element,...) 

To use this function, see the example on SDK

Bye








Zufferey David
Ing. Elec. dipl. HES
____________________________________

HEVs (University of Applied Sciences Valais)
GC Infotronique
Rte du Rawyl 47
CH-1950 Sion 2

Tel  : +41 27 606 8722
Fax : +41 27 606 8715
E-mail : [email protected]
____________________________________





-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.