Boost logo

Boost :

Subject: [boost] [crypto] Bug in md5
From: Konstantin Litvinenko (to.darkangel_at_[hidden])
Date: 2008-12-20 16:08:37


Hi All!

I just tried crypto library from the vault and immediately hit a bug :)

in message_digest.hpp

template<class Context>
std::string message_digest<Context>::to_string() const
{
   // !!!BUG!!! Should be context_type::digest_length * 2 + 1
   char buf[context_type::digest_length * 2];

   for (int i = 0; i < context_type::digest_length; ++i)
     std::sprintf(buf + i * 2, "%02x",
         static_cast<const unsigned char*>(digest())[i]);
   return std::string(buf, context_type::digest_length * 2);
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk