merge r3797:
allocate last zero byte in ngx_crypt()
This commit is contained in:
parent
a9166b8255
commit
1613129672
1 changed files with 4 additions and 4 deletions
|
@ -41,11 +41,11 @@ ngx_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
|
|||
err = ngx_errno;
|
||||
|
||||
if (err == 0) {
|
||||
len = ngx_strlen(value);
|
||||
len = ngx_strlen(value) + 1;
|
||||
|
||||
*encrypted = ngx_pnalloc(pool, len);
|
||||
if (*encrypted) {
|
||||
ngx_memcpy(*encrypted, value, len + 1);
|
||||
ngx_memcpy(*encrypted, value, len);
|
||||
return NGX_OK;
|
||||
}
|
||||
}
|
||||
|
@ -79,11 +79,11 @@ ngx_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
|
|||
value = crypt((char *) key, (char *) salt);
|
||||
|
||||
if (value) {
|
||||
len = ngx_strlen(value);
|
||||
len = ngx_strlen(value) + 1;
|
||||
|
||||
*encrypted = ngx_pnalloc(pool, len);
|
||||
if (*encrypted) {
|
||||
ngx_memcpy(*encrypted, value, len + 1);
|
||||
ngx_memcpy(*encrypted, value, len);
|
||||
}
|
||||
|
||||
#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
|
||||
|
|
Loading…
Reference in a new issue