Skip to content

Commit

Permalink
AP_Networking: use IP4_STR_LEN instead of value 16
Browse files Browse the repository at this point in the history
  • Loading branch information
bugobliterator committed Jun 18, 2024
1 parent 802c5b0 commit 39a4095
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/AP_Networking/AP_Networking_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ void AP_Networking::Port::tcp_server_loop(void)
sock = listen_sock->accept(100);
if (sock != nullptr) {
sock->set_blocking(false);
char buf[16];
char buf[IP4_STR_LEN];
uint16_t last_port;
const char *last_addr = listen_sock->last_recv_address(buf, sizeof(buf), last_port);
if (last_addr != nullptr) {
Expand Down Expand Up @@ -351,8 +351,8 @@ bool AP_Networking::Port::send_receive(void)
uint16_t last_port = 0;
if (sock->last_recv_address(last_addr, last_port)) {
if (!connected || (last_addr != last_udp_connect_address) || (last_port != last_udp_connect_port)) {
char last_addr_str[16];
sock->inet_addr_to_str(last_addr, last_addr_str, 16);
char last_addr_str[IP4_STR_LEN];
sock->inet_addr_to_str(last_addr, last_addr_str, sizeof(last_addr_str));
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "UDP[%u]: connected to %s:%u", unsigned(state.idx), last_addr_str, unsigned(last_port));
connected = true;
last_udp_connect_address = last_addr;
Expand Down

0 comments on commit 39a4095

Please sign in to comment.