summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2013-08-14 17:07:35 +0200
committerDr. Tilmann Bubeck <t.bubeck@reinform.de>2013-09-23 22:32:13 +0200
commiteee471e446405350c02c221f044a70669dac48a2 (patch)
tree1c5e0fe5e5cf85f5f0ff419db6a3c4ffcced9aa3 /process.c
parent6dda11c17f2fdc47d43f269dccee98ec66cc8c4b (diff)
downloadxorg-app-xauth-eee471e446405350c02c221f044a70669dac48a2.tar.gz
Don't crash when running past the end of the chain
Running past the end of the chain would cause a SEGV. Signed-off-by: Egbert Eich <eich@freedesktop.org>
Diffstat (limited to 'process.c')
-rw-r--r--process.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/process.c b/process.c
index 166b769..a9466a7 100644
--- a/process.c
+++ b/process.c
@@ -1280,8 +1280,11 @@ remove_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
/*
* unlink the auth we were asked to
*/
- while (!eq_auth((list = *listp)->auth, auth))
- listp = &list->next;
+ while (!eq_auth((list = *listp)->auth, auth)) {
+ listp = &list->next;
+ if (!*listp)
+ return 0;
+ }
*listp = list->next;
XauDisposeAuth (list->auth); /* free the auth */
free (list); /* free the link */