mirror of
https://github.com/svpcom/wfb-ng.git
synced 2025-02-23 00:23:48 -04:00
Warn if incoming packet > MAX_PAYLOAD_SIZE and will be truncated
This commit is contained in:
parent
f218f3936c
commit
d83bf94e65
@ -326,7 +326,7 @@ void data_source(shared_ptr<Transmitter> &t, vector<int> &rx_fd, int poll_timeou
|
||||
|
||||
if (fds[i].revents & POLLIN)
|
||||
{
|
||||
uint8_t buf[MAX_PAYLOAD_SIZE];
|
||||
uint8_t buf[MAX_PAYLOAD_SIZE + 1];
|
||||
ssize_t rsize;
|
||||
uint8_t cmsgbuf[CMSG_SPACE(sizeof(uint32_t))];
|
||||
|
||||
@ -354,6 +354,12 @@ void data_source(shared_ptr<Transmitter> &t, vector<int> &rx_fd, int poll_timeou
|
||||
break;
|
||||
}
|
||||
|
||||
if (rsize > MAX_PAYLOAD_SIZE)
|
||||
{
|
||||
fprintf(stderr, "Incoming packet size > %d and will be truncated\n", MAX_PAYLOAD_SIZE);
|
||||
rsize = MAX_PAYLOAD_SIZE;
|
||||
}
|
||||
|
||||
uint32_t cur_rxq_overflow = extract_rxq_overflow(&msghdr);
|
||||
if (cur_rxq_overflow != rxq_overflow)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user