Skip to content

Commit 7fb8dae

Browse files
kellyyehyxieca
authored andcommitted
[dhcp_relay] fix data type in dhcp6relay, add protection in packet data parsing (sonic-net#9036)
1 parent 5868b9e commit 7fb8dae

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/dhcp6relay/src/relay.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,15 +593,14 @@ void relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *
593593
void callback(evutil_socket_t fd, short event, void *arg) {
594594
struct relay_config *config = (struct relay_config *)(arg);
595595
static uint8_t message_buffer[4096];
596-
std::string counterVlan = counter_table;
597596
int32_t len = recv(config->filter, message_buffer, 4096, 0);
598597
if (len <= 0) {
599598
syslog(LOG_WARNING, "recv: Failed to receive data at filter socket: %s\n", strerror(errno));
600599
return;
601600
}
602601

603602
char* ptr = (char *)message_buffer;
604-
const uint8_t *current_position = (uint8_t *)ptr;
603+
const uint8_t *current_position = (uint8_t *)ptr;
605604
const uint8_t *tmp = NULL;
606605
const uint8_t *prev = NULL;
607606

@@ -623,7 +622,7 @@ void callback(evutil_socket_t fd, short event, void *arg) {
623622
prev = current_position;
624623
}
625624
while (ext_header->ip6e_nxt != IPPROTO_UDP);
626-
}
625+
}
627626

628627
auto udp_header = parse_udp(current_position, &tmp);
629628
current_position = tmp;

0 commit comments

Comments
 (0)