CVE-2013-4124 (Missing integer wrap protection in EA list reading can cause
server to loop with DOS).

   All current released versions of Samba are vulnerable to a denial of
   service on an authenticated or guest connection. A malformed packet
   can cause the smbd server to loop the CPU performing memory
   allocations and preventing any further service.

   A connection to a file share, or a local account is needed to exploit
   this problem, either authenticated or unauthenticated if guest
   connections are allowed.

   This flaw is not exploitable beyond causing the code to loop
   allocating memory, which may cause the machine to exceed memory
   limits.

diff -u -r --new-file --exclude .svn --exclude CVS samba-3.6.16/source3/smbd/nttrans.c samba-3.6.17/source3/smbd/nttrans.c
--- samba-3.6.16/source3/smbd/nttrans.c	2013-06-19 09:35:24.000000000 +0200
+++ samba-3.6.17/source3/smbd/nttrans.c	2013-07-29 20:55:18.000000000 +0200
@@ -989,7 +989,19 @@
 		if (next_offset == 0) {
 			break;
 		}
+
+		/* Integer wrap protection for the increment. */
+		if (offset + next_offset < offset) {
+			break;
+		}
+
 		offset += next_offset;
+
+		/* Integer wrap protection for while loop. */
+		if (offset + 4 < offset) {
+			break;
+		}
+
 	}
 
 	return ea_list_head;
