projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Default passphrase length of 1024, added -h/--help options.
[tinc]
/
src
/
encr.c
diff --git
a/src/encr.c
b/src/encr.c
index
e78ed5e
..
c34c1c9
100644
(file)
--- a/
src/encr.c
+++ b/
src/encr.c
@@
-107,7
+107,12
@@
int read_passphrase(char *which, char **out)
}
fscanf(f, "%d ", &size);
}
fscanf(f, "%d ", &size);
- size >>= 2; /* nibbles->bits */
+ if(size < 1 || size > (1<<15))
+ {
+ syslog(LOG_ERR, "Illegal passphrase in %s; size would be %d", filename, size);
+ return -1;
+ }
+ size >>= 2; /* bits->nibbles */
pp = xmalloc(size+2);
fgets(pp, size+1, f);
fclose(f);
pp = xmalloc(size+2);
fgets(pp, size+1, f);
fclose(f);