Ticket #412: valgrind-misalloc-with-crypt-apr1.patch

File valgrind-misalloc-with-crypt-apr1.patch, 577 bytes (added by markus-linnala.myopenid.com, 13 years ago)
  • src/core/ngx_crypt.c

    diff --git a/src/core/ngx_crypt.c b/src/core/ngx_crypt.c
    index 629d160..f3844a7 100644
    a b ngx_crypt_apr1(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)  
    137137
    138138    /* output */
    139139
    140     *encrypted = ngx_pnalloc(pool, sizeof("$apr1$") - 1 + saltlen + 16 + 1);
     140    /*                             $apr1$                 saltlen   $   md5    \0 */
     141    *encrypted = ngx_pnalloc(pool, sizeof("$apr1$") - 1 + saltlen + 1 + 4*5+2 + 1);
    141142    if (*encrypted == NULL) {
    142143        return NGX_ERROR;
    143144    }