<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"> ------------------------------------------------------------------------
r5168 | andersen | 2002-08-07 04:07:10 -0500 (Wed, 07 Aug 2002) | 4 lines
Changed paths:
   M /trunk/uClibc/libc/inet/rpc/xdr_array.c

Apply integer overflow security fix for "CERT Advisory CA-2002-25 Integer
Overflow In XDR Library" http://www.cert.org/advisories/CA-2002-25.html
Patch from Solar Designer &lt;solar@openwall.com&gt;.

 ------------------------------------------------------------------------
Index: libc/inet/rpc/xdr_array.c
===================================================================
--- libc/inet/rpc/xdr_array.c	(revision 5167)
+++ libc/inet/rpc/xdr_array.c	(revision 5168)
@@ -48,6 +48,7 @@
 #include &lt;string.h&gt;
 #include &lt;rpc/types.h&gt;
 #include &lt;rpc/xdr.h&gt;
+#include &lt;limits.h&gt;
 
 #ifdef USE_IN_LIBIO
 # include &lt;wchar.h&gt;
@@ -84,7 +85,11 @@
       return FALSE;
     }
   c = *sizep;
-  if ((c &gt; maxsize) &amp;&amp; (xdrs-&gt;x_op != XDR_FREE))
+  /*
+   * XXX: Let the overflow possibly happen with XDR_FREE because mem_free()
+   * doesn't actually use its second argument anyway.
+   */
+  if ((c &gt; maxsize || c &gt; UINT_MAX / elsize) &amp;&amp; (xdrs-&gt;x_op != XDR_FREE))
     {
       return FALSE;
     }
</pre></body></html>