You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Rick Jen <RJ...@cogentsystems.com> on 2006/01/14 04:59:44 UTC
null character in binary data
Hi,
I'm using Axis c++ axis-c-1.5.0-linux-src to implement web service for
my project to transfer binary data.
In the wsdl, the data type is defined as "base64Binary". But I found out
that if there's a null character in the binary data being transferred,
it's truncated after the null character. Then in my debug session I
found that in src/soap/SoapSerializer.cpp, it uses strcpy() to handle
the buffer:
SoapSerializer::SoapSerializer()
{
...skipping...
case XSD_BASE64BINARY:
if (pValue == NULL)
{
pParam->m_Value.b64bValue = NULL;
}
else
{
pParam->m_Value.b64bValue = new xsd__base64Binary;
pParam->m_Value.b64bValue->__size = (*((xsd__base64Binary *)
(pValue))).__size;
pParam->m_Value.b64bValue->__ptr = new
xsd__unsignedByte[pParam->m_Value.b64bValue->__size + 1];
// strcpy((char*)(pParam->m_Value.b64bValue->__ptr),
(char*)(*((xsd__base64Binary *) (pValue))).__ptr);
memcpy((char*)(pParam->m_Value.b64bValue->__ptr),
(char*)(*((xsd__base64Binary *) (pValue))).__ptr,
pParam->m_Value.b64bValue->__size);
}
break;
...skipping...
}
I tried memcpy instead and then it works fine.
Thanks,
- Rick
Re: null character in binary data
Posted by Adrian Dick <ad...@uk.ibm.com>.
Hi,
This area of code has been fixed since the release of 1.5
Can you try the latest 1.6 nightly driver (available at
http://cvs.apache.org/dist/axis/nightly)?
Adrian
_______________________________________
Adrian Dick (adrian.dick@uk.ibm.com)
"Rick Jen" <RJ...@cogentsystems.com> wrote on 14/01/2006 03:59:44:
> Hi,
>
> I’m using Axis c++ axis-c-1.5.0-linux-src to implement web service
> for my project to transfer binary data.
>
> In the wsdl, the data type is defined as “base64Binary”. But I found
> out that if there’s a null character in the binary data being
> transferred, it’s truncated after the null character. Then in my
> debug session I found that in src/soap/SoapSerializer.cpp, it uses
> strcpy() to handle the buffer:
>
> SoapSerializer::SoapSerializer()
> {
> ...skipping...
> case XSD_BASE64BINARY:
> if (pValue == NULL)
> {
> pParam->m_Value.b64bValue = NULL;
> }
> else
> {
> pParam->m_Value.b64bValue = new xsd__base64Binary;
> pParam->m_Value.b64bValue->__size =
> (*((xsd__base64Binary *) (pValue))).__size;
> pParam->m_Value.b64bValue->__ptr = new
> xsd__unsignedByte[pParam->m_Value.b64bValue->__size + 1];
> // strcpy((char*)(pParam->m_Value.b64bValue->__ptr),
> (char*)(*((xsd__base64Binary *) (pValue))).__ptr);
> memcpy((char*)(pParam->m_Value.b64bValue->__ptr), (char*)
> (*((xsd__base64Binary *) (pValue))).__ptr,
> pParam->m_Value.b64bValue->__size);
> }
> break;
> ...skipping...
> }
>
> I tried memcpy instead and then it works fine.
>
> Thanks,
>
> - Rick
>
>