CC: | bug-Net-SSLeay [...] rt.cpan.org |
Subject: | Incorrect use of sizeof in tlsext_ticket_key_cb_invoke |
Date: | Sun, 31 Jul 2016 07:47:04 -0400 |
To: | "A. Sinan Unur" <sinan [...] unur.com> |
From: | "A. Sinan Unur" <sinan [...] unur.com> |
I just built 1.76 where you moved from bzero to memset to fix
https://rt.cpan.org/Public/Bug/Display.html?id=116596
However, upon closer inspection, I see the following in the function
tlsext_ticket_key_cb_invoke
in file SSLeay.c in
https://cpan.metacpan.org/authors/id/M/MI/MIKEM/Net-SSLeay-1.76.tar.gz
One of the parameters of this function is:
unsigned char *key_name,
On line 1324, you have:
memset(key_name, 0, sizeof(key_name));
That is a serious bug. sizeof(pointer) will only ever return the size
of the pointer, not the area of the memory it points to. See also the
C FAQ:
http://c-faq.com/aryptr/aryparmsize.html
http://c-faq.com/malloc/sizeof.html
-- Sinan