Long passwords (and passwords ending with newlines) still have problems.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EncFS |
Fix Released
|
High
|
rosa maria |
Bug Description
Hi,
I reported via email that there were problems with passwords longer than 64 characters. Also, if the password is read from a file, the trailing character was removed, even if it was not a newline.
You partially fixed the problem in 1.4.0 by changing:
const int MaxPassBuf = 1024;
However, this change also needs to be made in the getNewUserKey function.
You also removed the code that trimmed off the newline. Unfortunately, now if the last character of the file *is* a newline, it is *no longer* removed. This change breaks old passwords, rendering old filesystems unreadable. Given that you are reading the password in with fgets, I think encfs should trim the newline, if it is present. (fgets is not a safe way to read in binary passwords.)
Below is a patch against 1.4.0 that fixes both of these issues.
--- encfs-1.
+++ encfs-1.
@@ -1153,6 +1153,10 @@
if( useStdin )
{
res = fgets( passBuf, sizeof(passBuf), stdin );
+ // Kill the trailing newline.
+ if (passBuf[ strlen(passBuf)-1 ] == '\n') {
+ passBuf[ strlen(passBuf)-1 ] = '\0';
+ }
} else
{
// xgroup(common)
@@ -1279,7 +1283,7 @@
CipherKey getNewUserKey( const shared_ptr<Cipher> &cipher )
{
- const int MaxPassBuf = 64;
+ const int MaxPassBuf = 1024;
CipherKey userKey;
char passBuf[
char passBuf2[
Changed in encfs: | |
status: | Confirmed → Fix Released |
Changed in encfs: | |
assignee: | nobody → rosa maria (rprosamaria383) |
Here is the above patch as an attachment.