Skip to content

Commit f8826f1

Browse files
Nari-19yashi
authored andcommitted
interfaces: udp: Replace literal number 4 with header_size
Replace the hardcoded literal `4` with the variable `header_size`. The literal `4` was a leftover from CSPv1. The variable `header_size` should be used for comparison against the return value of `csp_id_setup_rx()`, which is stored in `received_len`. Signed-off-by: Riho Natsushima <[email protected]> Signed-off-by: Yasushi SHOJI <[email protected]>
1 parent f896250 commit f8826f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interfaces/csp_if_udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int csp_if_udp_rx_work(int sockfd, size_t unused, csp_iface_t * iface) {
4646
int header_size = csp_id_setup_rx(packet);
4747
int received_len = recvfrom(sockfd, (char *)packet->frame_begin, sizeof(packet->data) + header_size, MSG_WAITALL, NULL, NULL);
4848

49-
if (received_len <= 4) {
49+
if (received_len <= header_size) {
5050
csp_buffer_free(packet);
5151
return CSP_ERR_NOMEM;
5252
}

0 commit comments

Comments
 (0)