mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-06 03:45:32 +00:00
Fixes Stack-buffer-overflow READ {*} · check_content_type_and_change_protocol
This commit is contained in:
parent
fba926d6a4
commit
3c0021d603
1 changed files with 4 additions and 6 deletions
|
|
@ -653,20 +653,18 @@ static void ndpi_check_http_server(struct ndpi_detection_module_struct *ndpi_str
|
|||
u_int i, j, a, b, c;
|
||||
char buf[16] = { '\0' };
|
||||
|
||||
for(i=off, j=0; (i<server_len) && (server[i] != ' ') && (j<sizeof(buf)); i++)
|
||||
for(i=off, j=0; (i<server_len) && (j<sizeof(buf))
|
||||
&& (isdigit(server[i]) || (server[i] == '.')); i++)
|
||||
buf[j++] = server[i];
|
||||
|
||||
if(sscanf(buf, "%d.%d.%d", &a, &b, &c) == 3) {
|
||||
u_int32_t version = (a * 1000000) + (b * 1000) + c;
|
||||
|
||||
char msg[64];
|
||||
|
||||
if((off == 7) && (version < MIN_APACHE_VERSION)) {
|
||||
char msg[64];
|
||||
|
||||
snprintf(msg, sizeof(msg), "Obsolete Apache server %s", buf);
|
||||
ndpi_set_risk(ndpi_struct, flow, NDPI_HTTP_OBSOLETE_SERVER, msg);
|
||||
} else if((off == 6) && (version < MIN_NGINX_VERSION)) {
|
||||
char msg[64];
|
||||
|
||||
snprintf(msg, sizeof(msg), "Obsolete nginx server %s", buf);
|
||||
ndpi_set_risk(ndpi_struct, flow, NDPI_HTTP_OBSOLETE_SERVER, msg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue