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

Egbert Eich eich at freedesktop.org
Wed Aug 14 08:07:35 PDT 2013


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

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
 process.c | 7 +++++--
 1 file 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 */
-- 
1.8.1.4



More information about the xorg-devel mailing list