In terms of Thread Safety and general security, would the following code have anything wrong with it?
std::string & toHexString( const uint8_t *buf, uint32_t size, std::string &out )
{
// modify 'out'
return out;
}
#ifndef TOHEXSTR
#define TOHEXSTR( x, y, ) ( toHexString( x, y, std::string() ) ).c_str()
#endif
The way this will be used is to print debug statements:
printf( "Byte buffer contents: [%s].", TOHEXSTR( buf, buf_size ) );
If there is a problem with this implementation, what should be changed?
Thanks.