Index: /trunk/docs/Changelog
===================================================================
--- /trunk/docs/Changelog	(revision 500)
+++ /trunk/docs/Changelog	(revision 501)
@@ -1,2 +1,5 @@
+4.1.3:
+	* fix regression with '--enable-static' in sh_static.c
+	  (reported by amaiket).
 4.1.2:
 	* add options --enable-selinux and --enable-posix-acl for "hard fail"
Index: /trunk/src/sh_static.c
===================================================================
--- /trunk/src/sh_static.c	(revision 500)
+++ /trunk/src/sh_static.c	(revision 501)
@@ -999,5 +999,5 @@
 		return -1;
 
-	while ((l = data[offset])) {
+	do {
 
 	        if (offset < INT_MAX)
@@ -1005,4 +1005,6 @@
 		else
 		        return -1;
+
+		l = data[offset];
 
 		if ((l & 0xc0) == (0xc0)) {
@@ -1018,5 +1020,6 @@
 		else
 		  return -1;
-	}
+
+	} while (l);
 
 	return offset - orig_offset;
@@ -1052,9 +1055,9 @@
 	        if (offset < INT_MAX) offset++;
 		else return -1;
-		if (measure && (total < INT_MAX))
-		    total++;
+		if (measure)
+		    { if (total < INT_MAX) total++; else return -1; }
 		if ((l & 0xc0) == (0xc0)) {
-		        if (measure && (total < INT_MAX))
-				total++;
+		        if (measure)
+			  { if (total < INT_MAX) total++; else return -1; }
 		        /* compressed item, redirect */ 
 			offset = ((l & 0x3f) << 8) | data[offset];
@@ -1082,6 +1085,6 @@
 		else
 		  return -1;
-		if (measure && (total <= (INT_MAX - l)))
-			total += l;
+		if (measure)
+		  { if (total <= (INT_MAX -l)) total += l; else return -1; }
 
 		if (used == INT_MAX)
@@ -1094,6 +1097,6 @@
 
 	/* The null byte must be counted too */
-	if (measure && (total < INT_MAX)) {
-	    total++;
+	if (measure) {
+	    if (total < INT_MAX) total++; else return -1; 
 	}
 
Index: /trunk/test/testrun_2.sh
===================================================================
--- /trunk/test/testrun_2.sh	(revision 500)
+++ /trunk/test/testrun_2.sh	(revision 501)
@@ -633,5 +633,5 @@
 	fi
 	#
-	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=client  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-encrypt=2
+	${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=client  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-encrypt=2 --enable-static
 	#
 	if test x$? = x0; then
