Compare commits

...

2 Commits

Author SHA1 Message Date
e199dc58cf Dont use deprecated api 2025-02-12 17:23:42 +01:00
ad7731d900 Fix out of memory access in parser 2023-07-04 19:09:53 +02:00
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ public:
if (poll_data.timeout_usec != UINT64_MAX) {
timer_.async_wait([this](boost::system::error_code const&) { processTimeout(); });
timer_.expires_from_now(boost::posix_time::microsec(poll_data.timeout_usec));
timer_.expires_after(boost::posix_time::microsec(poll_data.timeout_usec));
}
}

View File

@ -292,12 +292,12 @@ void Document::Expat::character_data_handler(void* data, const XML_Char* chars,
nod = &(nod->children.back());
}
int x = 0, y = len - 1;
int offset = 0, count = len;
while (isspace(chars[y]) && y > 0) --y;
while (isspace(chars[x]) && x < y) ++x;
while (count > 0 && isspace(chars[count - 1])) --count;
while (offset < count && isspace(chars[offset])) { ++offset; --count; }
nod->cdata = std::string(chars, x, y + 1);
nod->cdata = std::string{chars + offset, static_cast<std::string::size_type>(count)};
}
void Document::Expat::end_element_handler(void* data, const XML_Char* /*name*/)