mirror of
https://github.com/nginx/nginx.git
synced 2026-10-21 19:41:35 +00:00
allocate last zero byte in ngx_crypt()
This commit is contained in:
parent
f83d6cf0f7
commit
d4b08c9134
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…
Add table
Add a link
Reference in a new issue