mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Ensure str2AVal resets existing values and detects too-long inputs
This commit is contained in:
@@ -608,6 +608,7 @@ bool FingerTest::str2AVal(const char *str, const char *end) {
|
|||||||
}
|
}
|
||||||
u8 count = def->numAttrs;
|
u8 count = def->numAttrs;
|
||||||
std::vector<const char *> &AVs = *results;
|
std::vector<const char *> &AVs = *results;
|
||||||
|
for (u8 i = 0; i < count; i++) AVs[i] = NULL;
|
||||||
|
|
||||||
for (u8 i = 0; i < count && p < end; i++) {
|
for (u8 i = 0; i < count && p < end; i++) {
|
||||||
q = strchr_p(p, end, '=');
|
q = strchr_p(p, end, '=');
|
||||||
@@ -629,6 +630,10 @@ bool FingerTest::str2AVal(const char *str, const char *end) {
|
|||||||
AVs[idx->second] = string_pool_substr(p, q);
|
AVs[idx->second] = string_pool_substr(p, q);
|
||||||
p = q + 1;
|
p = q + 1;
|
||||||
}
|
}
|
||||||
|
if (p < end) {
|
||||||
|
error("Too many values in AVal string (%s)", str);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user