Imported Debian patch 2:1.15.1-0ubuntu2.6
[deb_xorg-server.git] / debian / patches / 122_xext_fix_card32_overflow_in_xauth.patch
diff --git a/debian/patches/122_xext_fix_card32_overflow_in_xauth.patch b/debian/patches/122_xext_fix_card32_overflow_in_xauth.patch
new file mode 100644 (file)
index 0000000..6f8cfab
--- /dev/null
@@ -0,0 +1,25 @@
+diff --git a/Xext/security.c b/Xext/security.c
+index 3699510..5e5a703 100644
+--- a/Xext/security.c
++++ b/Xext/security.c
+@@ -260,9 +260,9 @@ SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth,
+     /* maxSecs is the number of full seconds that can be expressed in
+      * 32 bits worth of milliseconds
+      */
+-    CARD32 maxSecs = (CARD32) (~0) / (CARD32) MILLI_PER_SECOND;
++    CARD32 maxSecs = (CARD32) (MAXINT) / (CARD32) MILLI_PER_SECOND;
+-    if (seconds > maxSecs) {    /* only come here if we want to wait more than 49 days */
++    if (seconds > maxSecs) {    /* only come here if we want to wait more than 24 days */
+         pAuth->secondsRemaining = seconds - maxSecs;
+         return maxSecs * MILLI_PER_SECOND;
+     }
+@@ -296,8 +296,6 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval)
+ {
+     SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
+-    assert(pAuth->timer == timer);
+-
+     if (pAuth->secondsRemaining) {
+         return SecurityComputeAuthorizationTimeout(pAuth,
+                                                    pAuth->secondsRemaining);