Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in hkdf code #81

Closed
wants to merge 1 commit into from
Closed

bug in hkdf code #81

wants to merge 1 commit into from

Conversation

sjaeckel
Copy link
Member

At

https://github.com/libtom/libtomcrypt/blob/develop/src/misc/hkdf/hkdf.c#L55

That should be an || not && comparison. Now if the pointer is null but the length is not the XMEMCPY later will dereference a NULL pointer.

@sjaeckel
Copy link
Member

IIRC I also already stumbled (at least once) over that line...

IIUC is this line correct. It errors-out in case the pointer is NULL but the length is not.

But it made me look at further access of the pointer and then I found http://stackoverflow.com/a/5243068

Don't call XMEMCPY() in case info (the source parameter to memcpy) is NULL
as this would trigger UB
@sjaeckel sjaeckel closed this in 8def190 Dec 5, 2015
@sjaeckel sjaeckel deleted the fix/hkdf branch December 5, 2015 13:33
@sjaeckel sjaeckel modified the milestone: v2.0.0 Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant