From f3a7c8f061336ca21c0e17642a087658e6e5d9ac Mon Sep 17 00:00:00 2001 From: oana Date: Thu, 21 Mar 2013 12:36:15 +0000 Subject: [PATCH] Warn about failing to encode hexified string. Do not encode the element into the ASN.1 payload if the encoding of the hexified string fails. git-svn-id: http://yate.null.ro/svn/yate/trunk@5424 acf43c95-373e-0410-b603-e72c3f656dc1 --- modules/sig/camel_map.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/sig/camel_map.cpp b/modules/sig/camel_map.cpp index 5c4efa6f..8bc82303 100644 --- a/modules/sig/camel_map.cpp +++ b/modules/sig/camel_map.cpp @@ -992,7 +992,10 @@ static bool encodeHex(const Parameter* param, MapCamelType* type, DataBlock& dat return false; XDebug(&__plugin,DebugAll,"encodeHexparam=%s[%p],elem=%s[%p])",param->name.c_str(),param,elem->getTag().c_str(),elem); const String& text = elem->getText(); - data.unHexify(text.c_str(),text.length(),' '); + if (!data.unHexify(text.c_str(),text.length(),' ')) { + Debug(&__plugin,DebugWarn,"Failed to parse hexified string '%s'",text.c_str()); + return false; + } data.insert(ASNLib::buildLength(data)); data.insert(param->tag.coding());; return true;