[Serdev] ser crashes if fix_nated_contact is called twice

Andrei Pelinescu-Onciul pelinescu-onciul at fokus.fraunhofer.de
Fri Aug 27 15:40:55 UTC 2004


On Aug 01, 2004 at 23:15, Richard <mypop3mail at yahoo.com> wrote:
> Hi,
> 
> If in a script, fix_nated_contact is called twice, it
> crashes ser. There is no reason to call it twice, but
> if does, it crashes.
> 
> Thanks,
> Richard
> 
> Jul 31 17:35:53 localhost /usr/local/sbin/ser[10441]:
> BUG: del_lump: offset exceeds message size (253160 >
> 1099) aborting...
> 

Yes, this is because of the way nathelper changes the contact, so that
 usrloc will see it. In the future we will try to come up with a better
 communication mechanism.

In the meantime, try the following patch, which should generate an error
message if fix_nated_contact is called more than once.

Maxim, could you apply it?

Andrei
-------------- next part --------------
--- modules/nathelper/nathelper.c.orig	2004-08-27 17:28:16.000000000 +0200
+++ modules/nathelper/nathelper.c	2004-08-27 17:34:22.000000000 +0200
@@ -531,6 +531,10 @@
 	if (uri.port.len == 0)
 		uri.port.s = uri.host.s + uri.host.len;
 
+	if ((c->uri.s < msg->buf)||(c->uri.s > (msg->buf+msg->len))){
+		LOG(L_ERR, "ERROR: fix_nated_contact called twice?\n");
+		return -1;
+	}
 	offset = c->uri.s - msg->buf;
 	anchor = del_lump(msg, offset, c->uri.len, HDR_CONTACT);
 	if (anchor == 0)


More information about the Serdev mailing list