Fixed buffer overrun in random::getString().

This commit is contained in:
Vincent Richard 2005-11-28 12:17:47 +00:00
parent 594dfdbd55
commit 296ce19306
2 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,9 @@ VERSION 0.8.1cvs
* maildirUtils.cpp: fixed problem with ':' in filename on Windows
platform (thanks to Benjamin Biron).
* random.cpp: fixed buffer overrun in random::getString (thanks
to Benjamin Biron).
2005-11-07 Vincent Richard <vincent@vincent-richard.net>
* SMTPTransport.cpp: fixed bug in disconnect() when authentication is

View File

@ -65,7 +65,7 @@ const string random::getString(const int length, const string& randomChars)
while (c < length)
{
for (unsigned int n = random::getNext() ; n != 0 ; n /= x)
for (unsigned int n = random::getNext() ; n != 0 && c < length ; n /= x)
{
res[c++] = randomChars[n % x];
}