Klaus Demo nginx / d4b08c9
allocate last zero byte in ngx_crypt() Igor Sysoev 10 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
4040 err = ngx_errno;
4141
4242 if (err == 0) {
43 len = ngx_strlen(value);
43 len = ngx_strlen(value) + 1;
4444
4545 *encrypted = ngx_pnalloc(pool, len);
4646 if (*encrypted) {
47 ngx_memcpy(*encrypted, value, len + 1);
47 ngx_memcpy(*encrypted, value, len);
4848 return NGX_OK;
4949 }
5050 }
7878 value = crypt((char *) key, (char *) salt);
7979
8080 if (value) {
81 len = ngx_strlen(value);
81 len = ngx_strlen(value) + 1;
8282
8383 *encrypted = ngx_pnalloc(pool, len);
8484 if (*encrypted) {
85 ngx_memcpy(*encrypted, value, len + 1);
85 ngx_memcpy(*encrypted, value, len);
8686 }
8787
8888 #if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)