Re: [PHP-DEV] Asking for a review of crypt() allocation changes

2012-06-30 Thread Ángel González
On 29/06/12 14:43, Nikita Popov wrote: > Hi internals! > > Anthony and me have been looking a lot at the crypt() code recently > and noticed that there are some strange things going on in the buffer > allocations for the sha algorithms. > > We did two commits to fix them up a bit: > > http://git.ph

Re: [PHP-DEV] Asking for a review of crypt() allocation changes

2012-06-29 Thread Rasmus Lerdorf
On 06/29/2012 05:56 AM, Anthony Ferrara wrote: > Additionally, it appears that SHA256/512 are way overallocating the buffer. > > For SHA512: > > int needed = (sizeof(sha512_salt_prefix) - 1 > + sizeof(sha512_rounds_prefix) + 9 + 1 > + salt_in_len +

Re: [PHP-DEV] Asking for a review of crypt() allocation changes

2012-06-29 Thread Anthony Ferrara
Additionally, it appears that SHA256/512 are way overallocating the buffer. For SHA512: int needed = (sizeof(sha512_salt_prefix) - 1 + sizeof(sha512_rounds_prefix) + 9 + 1 + salt_in_len + 1 + 86 + 1); output = emalloc(needed); salt[salt_in_len] = '\