path: root/client/gtk.c
diff options
authorSamuel Lidén Borell <>2010-02-23 14:51:41 +0100
committerSamuel Lidén Borell <>2010-02-23 14:51:41 +0100
commit34e19607424673d7fbf36380dd5e77eb8f994046 (patch)
tree0472ac7a949725b44c7052cafe7ba475d6c16da7 /client/gtk.c
parent9ac14e115a8cf5cc0771de30879efb74a4028d40 (diff)
Fix some bugs from the second last patch
These changes fix two bugs from the secure memory patch, 2605e8dd6ffd0b8cc710a3f91d58192cd510473a The one in gtk.c was caused by the password variable being dereferenced after it had been indexed (an operator precedence problem). This could cause a crash. The one in main.c was a logic error were an error message was sent as a parameter to the plugin. However, the plugin expects this parameter to be the Signature so this was wrong (but hard to spot!). I also changed a secmem_init_pool function to reset the pool pointer to NULL if mmap fails, to avoid errors later on.
Diffstat (limited to 'client/gtk.c')
1 files changed, 3 insertions, 3 deletions
diff --git a/client/gtk.c b/client/gtk.c
index 786d2c5..bb1ae3f 100644
--- a/client/gtk.c
+++ b/client/gtk.c
@@ -345,7 +345,7 @@ static void selectExternalFile() {
* the selected subject.
bool platform_sign(char **signature, int *siglen, KeyfileSubject **person,
- char **password, int password_maxlen) {
+ char *password, int password_maxlen) {
guint response;
// Restrict the password to the length of the preallocated
@@ -380,9 +380,9 @@ bool platform_sign(char **signature, int *siglen, KeyfileSubject **person,
// Copy the password to the secure buffer
- strncpy(*password, gtk_entry_get_text(passwordEntry), password_maxlen-1);
+ strncpy(password, gtk_entry_get_text(passwordEntry), password_maxlen-1);
// Be sure to terminate this under all circumstances
- *password[password_maxlen-1] = '\0';
+ password[password_maxlen-1] = '\0';
return true;
} else {
// User pressed cancel or closed the dialog