From 7fb8dae264fae55262820d107e4932eb2f09764d Mon Sep 17 00:00:00 2001 From: kellyyeh <42761586+kellyyeh@users.noreply.github.com> Date: Thu, 21 Oct 2021 23:00:37 -0700 Subject: [PATCH] [dhcp_relay] fix data type in dhcp6relay, add protection in packet data parsing (#9036) --- src/dhcp6relay/src/relay.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dhcp6relay/src/relay.cpp b/src/dhcp6relay/src/relay.cpp index 69f3593703..9301729bc4 100644 --- a/src/dhcp6relay/src/relay.cpp +++ b/src/dhcp6relay/src/relay.cpp @@ -593,7 +593,6 @@ void relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr * void callback(evutil_socket_t fd, short event, void *arg) { struct relay_config *config = (struct relay_config *)(arg); static uint8_t message_buffer[4096]; - std::string counterVlan = counter_table; int32_t len = recv(config->filter, message_buffer, 4096, 0); if (len <= 0) { syslog(LOG_WARNING, "recv: Failed to receive data at filter socket: %s\n", strerror(errno)); @@ -601,7 +600,7 @@ void callback(evutil_socket_t fd, short event, void *arg) { } char* ptr = (char *)message_buffer; - const uint8_t *current_position = (uint8_t *)ptr; + const uint8_t *current_position = (uint8_t *)ptr; const uint8_t *tmp = NULL; const uint8_t *prev = NULL; @@ -623,7 +622,7 @@ void callback(evutil_socket_t fd, short event, void *arg) { prev = current_position; } while (ext_header->ip6e_nxt != IPPROTO_UDP); - } + } auto udp_header = parse_udp(current_position, &tmp); current_position = tmp;