[reSIProcate] Parser hang
Dear resiprocate devels,
resiprocate 1.9.2
I have met the situation when some uacs send malformed Authorization
header, for example
Authorization: Digest
username="000999234",realm="1.1.1.1",nonce="1413544408:b15ee1a80dd75f9db443e2d4feab821b",uri="sip:1.1.1.1",=MD5,response="ef0f8cdc6a75fe810e2ce82a2758f45e".
You may notice that algorithm type is missing. In this case all
application hangs inside infinite loop.
Could you please take a look on the patch provided in attachment? Can
it be applied to Auth?
Sincerely, Taras.
diff --git a/resip/stack/Auth.cxx b/resip/stack/Auth.cxx
index a09e36c..2e96305 100644
--- a/resip/stack/Auth.cxx
+++ b/resip/stack/Auth.cxx
@@ -121,9 +121,17 @@ Auth::parseAuthParameters(ParseBuffer& pb)
static std::bitset<256> paramBegin=Data::toBitset(" \t\r\n=");
static std::bitset<256> terminators=Data::toBitset(" \t\r\n,");
const char* keyEnd = pb.skipToOneOf(paramBegin);
+ ParameterTypes::Type type = ParameterTypes::getType(keyStart, (unsigned int)(keyEnd - keyStart));
+
+ if( type == ParameterTypes::UNKNOWN )
+ {
+ throw ParseException("Unknown parameter",
+ "Auth::parseparameters",
+ __FILE__,__LINE__);
+ }
+
if((int)(keyEnd-keyStart) != 0)
{
- ParameterTypes::Type type = ParameterTypes::getType(keyStart, (unsigned int)(keyEnd - keyStart));
Parameter* p=createParam(type, pb, terminators, getPool());
if (!p)
{