fixed crash if extra headers were empty

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@705 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent 00eab592de
commit c6d5dec6f1

@ -295,11 +295,14 @@ int SipCtrlInterface::send(const AmSipReply &rep)
hdrs_len += content_type_len(stl2cstr(rep.content_type));
}
char* hdrs_buf = new char[hdrs_len];
char* c = hdrs_buf;
copy_hdrs_wr(&c,msg.hdrs);
content_type_wr(&c,stl2cstr(rep.content_type));
char* hdrs_buf = NULL;
if (hdrs_len) {
hdrs_buf = new char[hdrs_len];
char* c = hdrs_buf;
copy_hdrs_wr(&c,msg.hdrs);
content_type_wr(&c,stl2cstr(rep.content_type));
}
int ret = tl->send_reply(get_trans_bucket(h),(sip_trans*)t,
rep.code,stl2cstr(rep.reason),

@ -192,8 +192,10 @@ int trans_layer::send_reply(trans_bucket* bucket, sip_trans* t,
//contact_wr(&c,contact);
//}
memcpy(c,hdrs.s,hdrs.len);
c += hdrs.len;
if (hdrs.len) {
memcpy(c,hdrs.s,hdrs.len);
c += hdrs.len;
}
content_length_wr(&c,(char*)c_len.c_str());

Loading…
Cancel
Save