diff options
author | Igor Sysoev <igor@sysoev.ru> | 2010-11-29 12:23:25 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2010-11-29 12:23:25 +0300 |
commit | d4b08c9134d89ed17592935d56e611ae0fa31d32 (patch) | |
tree | a0d79d8426ce3d21de912c97a2657f5d17982e11 /src/os | |
parent | f83d6cf0f76266df12229ab4eba27e8ecdd193b0 (diff) |
allocate last zero byte in ngx_crypt()
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/unix/ngx_user.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/os/unix/ngx_user.c b/src/os/unix/ngx_user.c index 4bad1c307..165c6a46b 100644 --- a/src/os/unix/ngx_user.c +++ b/src/os/unix/ngx_user.c @@ -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) |