1
0
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:
dmiller
2022-12-02 21:57:30 +00:00
parent 06e6700268
commit 18a05139be

View File

@@ -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;
} }