summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSeppia <nonso@insicuri.net>2016-11-15 18:16:05 +0100
committerSeppia <nonso@insicuri.net>2016-11-15 18:16:05 +0100
commit6cea9aec8238c57767ebb6925206fdf65e618a45 (patch)
treee5af2d9349eea72325ca90f7dc76aec1d0f3e0f7 /src
parent827294d97af5aef30af4e7440786ede5f520ed9b (diff)
downloadonetimebluh-6cea9aec8238c57767ebb6925206fdf65e618a45.tar.gz
onetimebluh-6cea9aec8238c57767ebb6925206fdf65e618a45.tar.bz2
onetimebluh-6cea9aec8238c57767ebb6925206fdf65e618a45.zip
used dynamic allocation for key stream in keyrand function
Diffstat (limited to 'src')
-rw-r--r--src/onetimebluh.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/onetimebluh.c b/src/onetimebluh.c
index bdac2ff..2cca42e 100644
--- a/src/onetimebluh.c
+++ b/src/onetimebluh.c
@@ -203,7 +203,7 @@ void keyrand(int nb, char* outp) {
nb = 256;
}
- unsigned char key[nb];
+ unsigned char* key = malloc(nb);
RAND_bytes(key, nb);
if (outp == NULL) {
@@ -214,6 +214,7 @@ void keyrand(int nb, char* outp) {
FILE* file = fopen(outp, "w");
fwrite(key, sizeof(char), nb, file);
fclose(file);
+ free(key);
printf("Created key file %s of %d bytes \n", outp, nb);
} else {
printf("Byte number specified is 0. \n");