Fix out-of-bounds accesses and a leak in quisk.c and afedrinet_io.c
- afedrinet_io.c open_rx_udp: use snprintf so a long ip string cannot overflow the 128-byte stack buffer. - quisk.c set_multirx_mode, set_multirx_freq: reject a negative index. - quisk.c set_multirx_play_channel: treat a negative channel like an out-of-range one. - quisk.c measure_freq: keep ipeak inside [1, fft_size - 2] so that fft_average[ipeak - 1] and fft_average[ipeak + 1] stay in bounds when no peak is found. - quisk.c record_app: free the previous multirx_fft_next_samples buffer before allocating a new one, like fft_window and current_graph.
This commit is contained in:
@@ -128,10 +128,10 @@ static PyObject * open_rx_udp(const char * ip, int port)
|
||||
shutdown(rx_udp_socket, QUISK_SHUT_BOTH);
|
||||
close(rx_udp_socket);
|
||||
rx_udp_socket = INVALID_SOCKET;
|
||||
sprintf(buf, "Failed to connect to UDP %s port %u", ip, port);
|
||||
snprintf(buf, sizeof(buf), "Failed to connect to UDP %s port %u", ip, port);
|
||||
}
|
||||
else {
|
||||
sprintf(buf, "Capture from UDP %s port %u", ip, port);
|
||||
snprintf(buf, sizeof(buf), "Capture from UDP %s port %u", ip, port);
|
||||
#if DEBUG_IO
|
||||
if (getsockopt(rx_udp_socket, SOL_SOCKET, SO_RCVBUF, (char *)&intbuf, &bufsize) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user