about summary refs log tree commit diff
path: root/crypt/badsalttest.c
diff options
context:
space:
mode:
authorIl'ya Malakhov <ilmalakhov@yandex.ru>2018-01-31 14:32:19 -0800
committerCarlos O'Donell <carlos@redhat.com>2018-02-01 00:02:49 -0800
commit650ba77ad547b24e0839c90ed56f7b9445d8165a (patch)
tree27804a8a3292d9547ff9fa4ddc624782b6600525 /crypt/badsalttest.c
parentd9f442ce56a716ef4723a05ba913c5e2e78d3096 (diff)
downloadglibc-650ba77ad547b24e0839c90ed56f7b9445d8165a.tar.gz
glibc-650ba77ad547b24e0839c90ed56f7b9445d8165a.tar.xz
glibc-650ba77ad547b24e0839c90ed56f7b9445d8165a.zip
crypt: Fix badsalttest test (Bug 22765)
The value of 'cd.initialized' is left uninitialized before the
first invocation of 'crypt_r ()' in this test despite the fact
that it should be set to zero according to the API.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'crypt/badsalttest.c')
-rw-r--r--crypt/badsalttest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypt/badsalttest.c b/crypt/badsalttest.c
index 6c5230c399..3e57cdd3b8 100644
--- a/crypt/badsalttest.c
+++ b/crypt/badsalttest.c
@@ -61,6 +61,9 @@ do_test (void)
       tests[n - 1][1] = &page[pagesize - 1];
     }
 
+  /* Mark cd as initialized before first call to crypt_r.  */
+  cd.initialized = 0;
+
   for (size_t i = 0; i < n; i++)
     {
       if (crypt (tests[i][0], tests[i][1]))