From 072649d40fac6c4d014daa3478cd87cae7e40a8e Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Tue, 13 Oct 2009 20:37:49 +0000 Subject: [PATCH] only allocate/memcpy to-tag if len>0 git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1540 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/plug-in/sipctrl/trans_layer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/plug-in/sipctrl/trans_layer.cpp b/core/plug-in/sipctrl/trans_layer.cpp index 290abc91..5252e0f6 100644 --- a/core/plug-in/sipctrl/trans_layer.cpp +++ b/core/plug-in/sipctrl/trans_layer.cpp @@ -1074,9 +1074,14 @@ int trans_layer::update_uac_reply(trans_bucket* bucket, sip_trans* t, sip_msg* m t->reset_timer(STIMER_L, L_TIMER, bucket->get_id()); - t->to_tag.s = new char[to_tag.len]; - t->to_tag.len = to_tag.len; - memcpy((void*)t->to_tag.s,to_tag.s,to_tag.len); + if (t->to_tag.len>0) { + t->to_tag.s = new char[to_tag.len]; + t->to_tag.len = to_tag.len; + memcpy((void*)t->to_tag.s,to_tag.s,to_tag.len); + } else { + t->to_tag.s = NULL; + t->to_tag.len = 0; + } goto pass_reply;