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

Memory leaks #2

Open
cfcs opened this issue Aug 9, 2017 · 0 comments
Open

Memory leaks #2

cfcs opened this issue Aug 9, 2017 · 0 comments

Comments

@cfcs
Copy link

cfcs commented Aug 9, 2017

Hey!

I believe there's a memory leak here in the case where the base64-decoded data does not contain ::
https://github.com/pariahsoft/libvmod-authentication/blob/master/src/vmod_authentication.c#L25-L30
(I would have expected to see a free(c); before the return NULL;)

Also on these lines c is dereferenced before it has been checked if the malloc(sizeof(combination)); succeeded: and an assignment is made to the data at page 0:
https://github.com/pariahsoft/libvmod-authentication/blob/master/src/vmod_authentication.c#L33-L34

on a general note, strdup and strndup and friends are not verified to be successful allocations before being used.

Also, the base64_decode function is called twice on the input:
https://github.com/pariahsoft/libvmod-authentication/blob/master/src/vmod_authentication.c#L63-L70 (base64_decode_alloc also performs the decoding: https://github.com/pariahsoft/libvmod-authentication/blob/master/src/base64.c#L414)

Also, I believe this should be return false;? https://github.com/pariahsoft/libvmod-authentication/blob/master/src/base64.c#L412

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

No branches or pull requests

1 participant