I have a matching pair of static functions in a utility class that I use to convert between binary data (unsigned characters) and it\'s string representation (a-f and 0-9). They
Your sscanf
will write an unsigned int
into the memory location you give it. Typically, an unsigned int is 4 or 8 bytes long, while you only intend to provide 1 byte. So at the end you're running flat-out over the end of your dynamic array.
By the way, your code is very far removed from modern, idiomatic C++ - it's essentially just a glorified C mess. I strongly suggest rewriting it in the spirit of C++.