Skip to content

Commit c292c21

Browse files
committed
Fix possible buffer overread
1 parent a73b882 commit c292c21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

toxcore/group_announce.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ static int gca_unpack_announce(const Logger *log, const uint8_t *data, uint16_t
191191
}
192192

193193
if (announce->ip_port_is_set) {
194+
if (length - offset == 0) {
195+
return -1;
196+
}
197+
194198
const int ip_port_length = unpack_ip_port(&announce->ip_port, data + offset, length - offset, false);
195199

196200
if (ip_port_length == -1) {

0 commit comments

Comments
 (0)