few nitpicks on the code:

> int
> bin2hex (unsigned char *pcIbuf, unsigned char *pszObuf, unsigned int ilen)
> {
>  unsigned int  i;                      // loop iteration counter
>  unsigned int  j = (ilen * 2) + 1;     // output buffer length
>  unsigned char *p;
>
>  p = pszObuf;          // point to start of output buffer

^^^ given that you allow a MAXBUF input size, the worst case hexdump
output is 2*MAXBUF+1 which will overflow your obuf[] array, i.e.
corrupt stack.

>  for (i = 0; i < ilen; i++) {
>    sprintf_s (p, j, "%2.2x", (unsigned char) pcIbuf [i]);

You may try %02x as a format string instead; IIRC %2.2x does pad small
numbers with space instead of 0





-- 
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
        http://www.hebbut.net/
mail:   [EMAIL PROTECTED]
mobile: +31-6-11 120 978
--------------------------------------------------
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to