diff options
author | Karel Zak | 2006-12-07 00:26:31 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:26:31 +0100 |
commit | 756bfd018eb393640dad490df1a1ca840d9ee79b (patch) | |
tree | d95fd02eefcc647d4886761ccb74e976ee7aa32a /mount/lomount.c | |
parent | Imported from util-linux-2.12m tarball. (diff) | |
download | kernel-qcow2-util-linux-756bfd018eb393640dad490df1a1ca840d9ee79b.tar.gz kernel-qcow2-util-linux-756bfd018eb393640dad490df1a1ca840d9ee79b.tar.xz kernel-qcow2-util-linux-756bfd018eb393640dad490df1a1ca840d9ee79b.zip |
Imported from util-linux-2.12o tarball.
Diffstat (limited to 'mount/lomount.c')
-rw-r--r-- | mount/lomount.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mount/lomount.c b/mount/lomount.c index 002f34204..000a7b814 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -242,7 +242,7 @@ int set_loop(const char *device, const char *file, unsigned long long offset, const char *encryption, int pfd, int *loopro) { struct loop_info64 loopinfo64; - int fd, ffd, mode, i, n; + int fd, ffd, mode, i; char *pass; mode = (*loopro ? O_RDONLY : O_RDWR); @@ -299,11 +299,10 @@ set_loop(const char *device, const char *file, unsigned long long offset, default: pass = xgetpass(pfd, _("Password: ")); gotpass: + memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE); xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE); - n = strlen(pass); - memset(pass, 0, n); - loopinfo64.lo_encrypt_key_size = - (n < LO_KEY_SIZE) ? n : LO_KEY_SIZE; + memset(pass, 0, strlen(pass)); + loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE; } if (ioctl(fd, LOOP_SET_FD, ffd) < 0) { |