AllStarLink / app_rpt

Refactoring and upgrade of AllStarLink's app_rpt, etc.
5 stars 4 forks source link

res_rpt_http_registrations: NULL dereference in http_register #353

Closed Allan-N closed 1 month ago

Allan-N commented 1 month ago

From a corefile :

!@!@!@! brief.txt !@!@!@!

$2 = {si_signo = 11, si_errno = 0, si_code = 1, _sifields = {_pad = {0 <repeats 28 times>}, _kill = {si_pid = 0, si_uid = 0}, _timer = {si_tid = 0, si_overrun = 0, si_sigval = {sival_int = 0, sival_ptr = 0x0}}, _rt = {si_pid = 0, si_uid = 0, si_sigval = {sival_int = 0, sival_ptr = 0x0}}, _sigchld = {si_pid = 0, si_uid = 0, si_status = 0, si_utime = 0, si_stime = 0}, _sigfault = {si_addr = 0x0}, _sigpoll = {si_band = 0, si_fd = 0}, _sigsys = {_call_addr = 0x0, _syscall = 0, _arch = 0}}}
Signal        Stop  Print   Pass to program Description
SIGSEGV       Yes   Yes Yes     Segmentation fault
...
Thread 1 (Thread 0x7f3896f040 (LWP 13981)):
#0  index () at ../sysdeps/aarch64/strchr.S:62
#1  0x0000007f872c6e70 in __GI_strstr (haystack=haystack@entry=0x0, needle=needle@entry=0x7f39863838 "successfully registered") at ./string/strstr.c:84
#2  0x0000007f3986231c in http_register (reg=0x5570ab60d0) at ./res/res_rpt_http_registrations.c:253
#3  do_refresh (varg=varg@entry=0x0) at ./res/res_rpt_http_registrations.c:289
#4  0x000000556624537c in dummy_start (data=<optimized out>) at ./main/utils.c:1607
#5  0x0000007f872aee58 in start_thread (arg=0x7fed1e3ca7) at ./nptl/pthread_create.c:442
#6  0x0000007f87317f9c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:79
Allan-N commented 1 month ago

Here's a shell script that (for me) shows the issue with unexpected registration response. In the first case we get back a response with the expected "data" element. In the second case, there is no "data" element ... and that's what the code had expected to be present. Probably need to look at the server code but we also should ensure that the client will not crash.

Note: I had to add the ".txt" extension to the filename in order to upload to GitHub

rpt_http_test.sh.txt