| 266 | |
| 267 | |
| 268 | char* rport_builder(struct sip_msg *msg, unsigned int *rport_len) |
| 269 | { |
| 270 | char* buf, * tmp; |
| 271 | int len, tmp_len; |
| 272 | |
| 273 | tmp_len=0; |
| 274 | tmp=int2str(msg->rcv.src_port, &tmp_len); |
| 275 | len=RPORT_LEN+tmp_len; |
| 276 | buf=pkg_malloc(sizeof(char)*(len+1));/* space for null term */ |
| 277 | if (buf==0){ |
| 278 | ser_error=E_OUT_OF_MEM; |
| 279 | LM_ERR("out of pkg memory\n"); |
| 280 | return 0; |
| 281 | } |
| 282 | memcpy(buf, RPORT, RPORT_LEN); |
| 283 | memcpy(buf+RPORT_LEN, tmp, tmp_len); |
| 284 | buf[len]=0; /*null terminate it*/ |
| 285 | |
| 286 | *rport_len=len; |
| 287 | return buf; |
| 288 | } |
| 289 | |
| 290 | |
| 291 |
no test coverage detected