[PATCH xauth] Don't crash when running past the end of the chain

Egbert Eich eich at freedesktop.org
Tue Jul 30 02:00:13 PDT 2013


Running past the end of the chain would cause a SEGV.

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
 process.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/process.c b/process.c
index 166b769..0f719ce 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))
+    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 */
-- 
1.8.1.4



More information about the xorg-devel mailing list