summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-04-08 20:09:47 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-04-08 20:09:47 +0000
commit72228eec71850a448d0b8957b68e5f296aea78f2 (patch)
tree5d7d823e874d6ca02e1ae15946f79cdfde087062 /regress
parent02d836163d83b98646740e86de95f86529a4e3dc (diff)
add a test for writing too far
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libutil/bcrypt_pbkdf/bcrypt_pbkdf_test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/regress/lib/libutil/bcrypt_pbkdf/bcrypt_pbkdf_test.c b/regress/lib/libutil/bcrypt_pbkdf/bcrypt_pbkdf_test.c
index bd79e590c25..7add5019898 100644
--- a/regress/lib/libutil/bcrypt_pbkdf/bcrypt_pbkdf_test.c
+++ b/regress/lib/libutil/bcrypt_pbkdf/bcrypt_pbkdf_test.c
@@ -1,5 +1,6 @@
#include <inttypes.h>
#include <stdio.h>
+#include <string.h>
#include <util.h>
@@ -112,6 +113,14 @@ main()
struct test *t;
fails = 0;
+
+ memset(key, 0, 1024);
+ bcrypt_pbkdf("password", 8, "salt", 4, key, 88, 4);
+ if (key[88] || key[89] || key[90]) {
+ printf("OVERWRITE\n");
+ fails++;
+ }
+
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
t = &tests[i];
bcrypt_pbkdf(t->password, t->passlen, t->salt, t->saltlen,