Author: hyc Date: Thu Mar 4 08:48:55 2010 New Revision: 284 Log: Fix decoding of Long Strings Modified: trunk/amf.c trunk/amf.h Modified: trunk/amf.c ============================================================================== --- trunk/amf.c Thu Mar 4 08:25:29 2010 (r283) +++ trunk/amf.c Thu Mar 4 08:48:55 2010 (r284) @@ -67,6 +67,13 @@ AMF_DecodeString(const char *data, AVal bv->av_val = (bv->av_len > 0) ? (char *) data + 2 : NULL; } +void +AMF_DecodeLongString(const char *data, AVal * bv) +{ + bv->av_len = AMF_DecodeInt32(data); + bv->av_val = (bv->av_len > 0) ? (char *) data + 4 : NULL; +} + double AMF_DecodeNumber(const char *data) { @@ -718,7 +725,7 @@ AMFProp_Decode(AMFObjectProperty * prop, unsigned int nStringSize = AMF_DecodeInt32(pBuffer); if (nSize < (long) nStringSize + 4) return -1; - AMF_DecodeString(pBuffer, &prop->p_vu.p_aval); + AMF_DecodeLongString(pBuffer, &prop->p_vu.p_aval); nSize -= (4 + nStringSize); prop->p_type = AMF_STRING; break; Modified: trunk/amf.h ============================================================================== --- trunk/amf.h Thu Mar 4 08:25:29 2010 (r283) +++ trunk/amf.h Thu Mar 4 08:48:55 2010 (r284) @@ -99,6 +99,7 @@ extern "C" unsigned int AMF_DecodeInt24(const char *data); unsigned int AMF_DecodeInt32(const char *data); void AMF_DecodeString(const char *data, AVal * str); + void AMF_DecodeLongString(const char *data, AVal * str); bool AMF_DecodeBoolean(const char *data); double AMF_DecodeNumber(const char *data);
participants (1)
-
hyc