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

Fix invalid storage reference in getkey() #609

Closed
wants to merge 1 commit into from

Conversation

trawick
Copy link
Contributor

@trawick trawick commented Dec 6, 2013

Fix invalid storage reference by apr_psprintf() when creating a string from salt[]. salt[] is not
'\0'-terminated, so apr_psprintf() needs to be told the extent of the bytes to read.

It is easy to test old/new code standalone with valgrind; just insert the getkey() function into this template:

include <stdio.h>

include "apr_general.h"

include "apr_strings.h"

include "apr_base64.h"

include "apr_sha1.h"

<<<<getkey() goes here>>>>

int main(void)
{
apr_pool_t *p;

apr_initialize();
apr_pool_create(&p, NULL);

printf("%s\n", getkey(p));
return 0;

}

when creating a string from salt[].  salt[] is not
'\0'-terminated, so apr_psprintf() needs to be told
the extent of the bytes to read.

It is easy to test old/new code standalone with valgrind;
jst insert the getkey() function into this template:

-----------getkey() goes here-----------------

int main(void)
{
    apr_pool_t *p;

    apr_initialize();
    apr_pool_create(&p, NULL);

    printf("%s\n", getkey(p));
    return 0;
}
@zimmerle
Copy link
Contributor

Hi @trawick,

Bug is confirmed. I've made some comments on your commit. Thanks for the merge request.

@zimmerle
Copy link
Contributor

Hi @trawick, are you still working on this?

@zimmerle zimmerle force-pushed the master branch 2 times, most recently from e516f4c to 84f2299 Compare November 3, 2014 19:45
zimmerle pushed a commit that referenced this pull request Apr 6, 2015
@zimmerle
Copy link
Contributor

zimmerle commented Apr 6, 2015

Merged the original request plus some updates.

@zimmerle zimmerle closed this Apr 6, 2015
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.

2 participants