[PATCH] cryptsetup-luks: abort on ctrl-d

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

fail if user enters ^D at password prompt instead of trying to use
uninitialized memory as password.

Signed-off-by: Ludwig Nussel <ludwig.nussel@xxxxxxx>

Index: cryptsetup-luks-1.0.4_SVN26/lib/setup.c
===================================================================
--- cryptsetup-luks-1.0.4_SVN26.orig/lib/setup.c
+++ cryptsetup-luks-1.0.4_SVN26/lib/setup.c
@@ -77,6 +77,9 @@ static int untimed_read(int fd, char *pa
 	if (i > 0) {
 		pass[i-1] = '\0';
 		i = 0;
+	} else if (i == 0) { /* EOF */
+		*pass = 0;
+		i = -1;
 	}
 	return i;
 }
@@ -672,6 +675,7 @@ start:
 	safe_free(password);
  out:
 	LUKS_dealloc_masterkey(mk);
+	mk = NULL;
 	if (r == -EPERM && tries > 0)
 		goto start;
 
-- 
 (o_   Ludwig Nussel
 //\   SUSE Labs
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)


---------------------------------------------------------------------
dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx


[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux