From: hyc Date: Thu, 4 Mar 2010 07:48:55 +0000 (+0000) Subject: Fix decoding of Long Strings X-Git-Tag: v2.4~245 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f494d191db86897ca6068c2d3cbdc252e05ac714;p=rtmpdump Fix decoding of Long Strings git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@284 400ebc74-4327-4243-bc38-086b20814532 --- diff --git a/amf.c b/amf.c index 70432a5..9f322c3 100644 --- a/amf.c +++ b/amf.c @@ -67,6 +67,13 @@ AMF_DecodeString(const char *data, AVal * bv) 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, const char *pBuffer, int nSize, 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; diff --git a/amf.h b/amf.h index c94c6b5..ce4b442 100644 --- a/amf.h +++ b/amf.h @@ -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);