From eee471e446405350c02c221f044a70669dac48a2 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Wed, 14 Aug 2013 17:07:35 +0200 Subject: 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 --- process.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'process.c') 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 */ -- cgit v1.2.1