I ran the code in gdb and this is the stack trace. At refclock_nmea.c:
178 this code causes the crash
nmea_port = atoi(strtok(NULL,":"));
I am not really sure of why strtok is used on a NULL string. I assume
strtok return a NULL based on the trace, and then atoi calls strtool
which leads to a crash. Possibly, this is a libc64 bug, as I would
expect atoi to detect a null string and not to crash.
#0 0x0000003361a341ca in ____strtoll_l_internal () from /lib64/
libc.so.6
#1 0x0000003361a31ab2 in atoi () from /lib64/libc.so.6
#2 0x0000000000443515 in nmea_start (unit=0, peer=0x69cb58) at
refclock_nmea.c:178
#3 0x000000000042bb9c in refclock_newpeer (peer=0x69cb58) at
ntp_refclock.c:276
#4 0x0000000000422fab in newpeer (srcadr=0x7fff552f88a0,
dstadr=0x6ef0b0, hmode=3, version=4, minpoll=4, maxpoll=10, flags=129,
cast_flags=1 '\001', ttl=0, key=0) at ntp_peer.c:837
#5 0x00000000004222ea in peer_config (srcadr=0x7fff552f88a0,
dstadr=0x6ef0b0, hmode=3, version=4, minpoll=4, maxpoll=10, flags=128,
ttl=0, key=0,
keystr=0x4776c1 "*") at ntp_peer.c:525
#6 0x000000000040619a in getconfig (argc=0, argv=0x7fff552f8bd8) at
ntp_config.c:864
#7 0x000000000040f5a6 in ntpdmain (argc=0, argv=0x7fff552f8bd8) at
ntpd.c:846
#8 0x000000000040f0ec in main (argc=4, argv=0x7fff552f8bb8) at ntpd.c:
317
(gdb) up
#1 0x0000003361a31ab2 in atoi () from /lib64/libc.so.6
(gdb) up
#2 0x0000000000443515 in nmea_start (unit=0, peer=0x69cb58) at
refclock_nmea.c:178
178 nmea_port = atoi(strtok(NULL,":"));
_______________________________________________
questions mailing list
[email protected]
https://lists.ntp.org/mailman/listinfo/questions