rx_tools icon indicating copy to clipboard operation
rx_tools copied to clipboard

rx_power: crash in frequency_range with invalid argument

Open rxseger opened this issue 9 years ago • 0 comments

rx_tools $ lldb ./rx_power -- -f a:b
(lldb) target create "./rx_power"
Current executable set to './rx_power' (x86_64).
(lldb) settings set -- target.run-args  "-f" "a:b"
(lldb) r
Process 49615 launched: './rx_power' (x86_64)
Process 49615 stopped
* thread #1: tid = 0x417cf6, 0x00000001000015b4 rx_power`frequency_range(arg="a", crop=0) + 84 at rtl_power.c:443, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001000015b4 rx_power`frequency_range(arg="a", crop=0) + 84 at rtl_power.c:443
   440      stop = strchr(start, ':') + 1;
   441      stop[-1] = '\0';
   442      step = strchr(stop, ':') + 1;
-> 443      step[-1] = '\0';
   444      lower = (int)atofs(start);
   445      upper = (int)atofs(stop);
   446      max_size = (int)atofs(step);

The comment above the parsing says /* hacky string parsing */, should add some extra checks to be safe (example of correct arguments: -f 0.1M:6G:1M)

rxseger avatar Jul 18 '16 04:07 rxseger