ecryptfs-add-passphrase crashes with "Segmentation fault" message if ~/.ecryptfsrc file exists

Bug #409565 reported by Dorin Scutarașu on 2009-08-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eCryptfs
High
Dustin Kirkland 

Bug Description

This happens on ecryptfs-utils binaries that I've built from revision 438.

* Steps to reproduce:

$ cat 'salt=0011223344556677' > ~/.ecryptfsrc
$ ecryptfs-add-passphrase
Passphrase: [ insert random passphrase ]
Segmentation fault

It looks like it's caused by dereferencing a null pointer at src/libecryptfs/key_management.c:694 .

-- Begin patch --------
=== modified file 'src/libecryptfs/key_management.c'
--- src/libecryptfs/key_management.c 2009-07-21 21:27:10 +0000
+++ src/libecryptfs/key_management.c 2009-08-05 20:09:03 +0000
@@ -689,7 +689,7 @@
                }
                goto out;
        }
- nvp = &nvp_list_head;
+ nvp = nvp_list_head.next;
        while (nvp) {
                if (strcmp(nvp->name, "salt") == 0) {
                        int valsize;
-- End patch --------

When parsing ~/.ecryptfsrc file, a list of ecryptfs_name_val_pair is created and name, value pairs are set starting from the second list element. the list's head only has the next attribute set, hence the null pointer dereference when calling strcmp(nvp->name, "salt"). Patched to start iterating from nvp_list_head->next, as done elsewhere in the code ( such as in src/libecryptfs/decision_graph.c:get_verbosity ).

Changed in ecryptfs:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Dustin Kirkland (kirkland)
Dustin Kirkland  (kirkland) wrote :

Thanks for the patch! Fix committed.

:-Dustin

Changed in ecryptfs:
status: Triaged → Fix Committed
Changed in ecryptfs:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers