sergev/pic32prog

segmentation fault when selecting baud rate

Opened this issue · 1 comments

when specifying the baud rate before the device the program will dump core.

pic32prog -b 9600 -d /dev/ttyAMA0 led/mx250.hex
Programmer for Microchip PIC32 microcontrollers, Version 2.0.189
Segmentation fault (core dumped)

the core dump occurs here in pic32prog.c at this line
if (strncasecmp("ascii:", target_port, 6) != 0) // *** HORRIBLE HACK!! ***
#0 0xb6e70894 in __strncasecmp (s1=, s2=, n=6) at strncase.c:67

bye

now i DID say it was a horrible hack!

looks like target_port is undefined, which is causing strncasecmp to suffer from severe indigestion. i would suggest editing line 68 to something like:
const char *target_port = 0;

and adding an extra check before line 748:
if ((target_port == 0) || // *** de-horriblification ***
(strncasecmp("ascii:", target_port, 6) != 0)) // *** HORRIBLE HACK!! ***

the above is untested. serge, would you be able to add this into the code? assuming i have the syntax correct, of course!

cheers,
rob :-)