Skip to content

Commit

Permalink
Fix possible buffer overread
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Apr 2, 2022
1 parent a73b882 commit c292c21
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions toxcore/group_announce.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ static int gca_unpack_announce(const Logger *log, const uint8_t *data, uint16_t
}

if (announce->ip_port_is_set) {
if (length - offset == 0) {
return -1;
}

const int ip_port_length = unpack_ip_port(&announce->ip_port, data + offset, length - offset, false);

if (ip_port_length == -1) {
Expand Down

0 comments on commit c292c21

Please sign in to comment.