mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
analyzer/protocol/ident: fix buffer overflow in ParsePort()
The given buffer is not null-terminated; the method must obey the "end_of_line" pointer.
This commit is contained in:
parent
f849571910
commit
9b2709ca18
1 changed files with 2 additions and 2 deletions
|
@ -215,7 +215,7 @@ const char* Ident_Analyzer::ParsePort(const char* line, const char* end_of_line,
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
line = skip_whitespace(line, end_of_line);
|
line = skip_whitespace(line, end_of_line);
|
||||||
if ( ! isdigit(*line) )
|
if ( line >= end_of_line || ! isdigit(*line) )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const char* l = line;
|
const char* l = line;
|
||||||
|
@ -225,7 +225,7 @@ const char* Ident_Analyzer::ParsePort(const char* line, const char* end_of_line,
|
||||||
n = n * 10 + (*line - '0');
|
n = n * 10 + (*line - '0');
|
||||||
++line;
|
++line;
|
||||||
}
|
}
|
||||||
while ( isdigit(*line) );
|
while ( line < end_of_line && isdigit(*line) );
|
||||||
|
|
||||||
line = skip_whitespace(line, end_of_line);
|
line = skip_whitespace(line, end_of_line);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue