- Fix a crash when an empty passphrase is provided Resolves: #558410

This commit is contained in:
Miloslav Trmac 2010-02-05 17:01:26 +00:00
parent 2c2f8b1b47
commit a677246089
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,56 @@
commit 02ba974efaf3b12f548d83f0584917dfcfd1cb1b
Author: Miloslav Trmač <mitr@redhat.com>
Date: Fri Feb 5 17:53:21 2010 +0100
Fix crash if passphrase_ui_cb () fails.
2010-02-05 Miloslav Trmač <mitr@redhat.com>
* src/volume_key.c (pos_init): Set *error if passphrase_ui_cb () fails.
diff --git a/ChangeLog b/ChangeLog
index 72f053b..1ab28d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-02-05 Miloslav Trmač <mitr@redhat.com>
+
+ * src/volume_key.c (pos_init): Set *error if passphrase_ui_cb () fails.
+
2009-12-11 Miloslav Trmač <mitr@redhat.com>
* configure.ac: Release 0.3.1.
diff --git a/src/volume_key.c b/src/volume_key.c
index 361aa86..68c837a 100644
--- a/src/volume_key.c
+++ b/src/volume_key.c
@@ -581,7 +581,7 @@ pos_init (struct packet_output_state *pos, GError **error)
: _("Passphrases do not match. "
"New packet passphrase"), failed);
if (passphrase == NULL)
- return -1;
+ goto no_passphrase;
passphrase2 = passphrase_ui_cb (NULL,
_("Repeat new packet passphrase"),
failed);
@@ -589,7 +589,7 @@ pos_init (struct packet_output_state *pos, GError **error)
{
memset (passphrase, 0, strlen (passphrase));
g_free (passphrase);
- return -1;
+ goto no_passphrase;
}
passphrase_ok = strcmp (passphrase, passphrase2) == 0;
memset (passphrase2, 0, strlen (passphrase2));
@@ -607,6 +607,11 @@ pos_init (struct packet_output_state *pos, GError **error)
pos->passphrase = passphrase;
}
return 0;
+
+ no_passphrase:
+ g_set_error (error, LIBVK_ERROR, LIBVK_ERROR_UI_NO_RESPONSE,
+ _("Passphrase not provided"));
+ return -1;
}
/* Free data in POS */

View File

@ -3,13 +3,15 @@
Summary: An utility for manipulating storage encryption keys and passphrases
Name: volume_key
Version: 0.3.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Group: Applications/System
URL: https://fedorahosted.org/volume_key/
Requires: volume_key-libs = %{version}-%{release}
Source0: https://fedorahosted.org/releases/v/o/volume_key/volume_key-%{version}.tar.bz2
# Committed upstrean
Patch0: volume_key-0.3.1-empty-passphrase.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: cryptsetup-luks-devel, gettext-devel, glib2-devel, gnupg
BuildRequires: gpgme-devel, libblkid-devel, nss-devel, python-devel
@ -74,6 +76,7 @@ for other formats is possible, some formats are planned for future releases.
%prep
%setup -q
%patch0 -p1 -b .empty-passphrase
%build
%configure
@ -116,6 +119,10 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitearch}/volume_key.py*
%changelog
* Fri Feb 5 2010 Miloslav Trmač <mitr@redhat.com> - 0.3.1-2
- Fix a crash when an empty passphrase is provided
Resolves: #558410
* Fri Dec 11 2009 Miloslav Trmač <mitr@redhat.com> - 0.3.1-1
- Update to volume_key-0.3.1.