#96 3.1 get_remote_port_media throws away part of port number

v3.4
closed-fixed
Rob Day
None
5
2013-04-02
2008-04-29
Kevin McAllister
No

I found that when using the pcapplay to send a ulaw stream that if my asterisk server told it to send media to 13134, sipp was sending media to 1313.

Looking at the source, it looks like the pointer math is just off in get_remote_port_media() in call.cpp.

--- sipp.svn/call.cpp 2008-04-09 10:50:37.000000000 -0400
+++ sipp.svn.patched/call.cpp 2008-04-29 12:52:20.000000000 -0400
@@ -192,7 +192,7 @@
/* m=audio not found */
return 0;
}
- begin += strlen(pattern) - 1;
+ begin += strlen(pattern);
end = strstr(begin, "\r\n");
if (!end)
ERROR("get_remote_port_media: no CRLF found");

if you leave the -1 in there begin ends up pointing at the blank space after the pattern, so for m=audio 13134 it is pointing at the space between the o and 1, and your strncpy will grab 5 characters starting with the blank space omitting the 4.

Discussion

  • J R
    J R
    2008-05-20

    Logged In: YES
    user_id=2093007
    Originator: NO

    Am running into the same issue-- had to restrict ports up to 9999 in Office Communcations Server. Looking forward to a fix! :)

     
  • Diego Serafin
    Diego Serafin
    2008-05-26

    Logged In: YES
    user_id=1182927
    Originator: NO

    Same problem here,
    port number truncation.
    thanks for the patch. I hope it will be quickly accepted.

    Regards,
    Diego.

     
  • Rob Day
    Rob Day
    2012-12-15

    Fixed in v3.2 by using a larger array, but we should fix up the pointer arithmetic anyway.

     
  • Rob Day
    Rob Day
    2012-12-15

    • assigned_to: Rob Day
    • milestone: --> v3.4
     
  • Rob Day
    Rob Day
    2013-04-02

    • status: open --> closed-fixed