Fixes OOB reads in postgres
Reported by GHSL
This commit is contained in:
@@ -97,7 +97,7 @@ void ndpi_search_postgres_tcp(struct ndpi_detection_module_struct
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size = (u_int16_t)ntohl(get_u_int32_t(packet->payload, 1)) + 1;
|
size = (u_int16_t)ntohl(get_u_int32_t(packet->payload, 1)) + 1;
|
||||||
if (packet->payload[size - 1] == 'S') {
|
if (size > 0 && size - 1 < packet->payload_packet_len && packet->payload[size - 1] == 'S') {
|
||||||
if ((size + get_u_int32_t(packet->payload, (size + 1))) == packet->payload_packet_len) {
|
if ((size + get_u_int32_t(packet->payload, (size + 1))) == packet->payload_packet_len) {
|
||||||
NDPI_LOG_INFO(ndpi_struct, "found postgres asymmetrically\n");
|
NDPI_LOG_INFO(ndpi_struct, "found postgres asymmetrically\n");
|
||||||
ndpi_int_postgres_add_connection(ndpi_struct, flow);
|
ndpi_int_postgres_add_connection(ndpi_struct, flow);
|
||||||
@@ -105,7 +105,7 @@ void ndpi_search_postgres_tcp(struct ndpi_detection_module_struct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
size += get_u_int32_t(packet->payload, (size + 1)) + 1;
|
size += get_u_int32_t(packet->payload, (size + 1)) + 1;
|
||||||
if (packet->payload[size - 1] == 'S') {
|
if (size > 0 && size - 1 < packet->payload_packet_len && packet->payload[size - 1] == 'S') {
|
||||||
NDPI_LOG_INFO(ndpi_struct, "found postgres asymmetrically\n");
|
NDPI_LOG_INFO(ndpi_struct, "found postgres asymmetrically\n");
|
||||||
ndpi_int_postgres_add_connection(ndpi_struct, flow);
|
ndpi_int_postgres_add_connection(ndpi_struct, flow);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user