rosserial embedded tcp custom port fail
Hi there!
i just played around with rosserial and an tcp connection to my tiny linux board. Going through the tutorial is quiet easy. But if i try to run my node on a custom port it gives me:
Connecting to TCP server at 192.168.1.5}L�����ǐHu+�T���h俋�AH}L������H>T:11420....
code snippet:
....
char *rosSrvrIp = "192.168.1.5:11420";
....
nh.initNode(rosSrvrIp);
Diggin into ros_lib/embedded_linux_comms.c i found this else-Path for a custom port: (somewhere around line 128)
else
{
tcpPortNum = strtol(tcpPortNumString + 1, NULL, 10);
strncpy(ip, portName, tcpPortNumString - portName);
}
printf("Connecting to TCP server at %s:%ld....\n", ip, tcpPortNum);
I have added following line after the strncpy-line:
ip[tcpPortNumString - portName] = '\0'; // set null-terminator
An now it works for me
Question: Have i missed something obvious or does it belong to my compiler (gcc 5.3) ?
I would recommend to report this over at ros-drivers/rosserial/issues instead of opening a Q&A here: it's an issue, not a question we can answer.
Following up: seeing as you have a candidate solution, I would recommend submitted a PR as well.