1ee46d
--- cvsps-2.2b1/cvsps.c	2010-09-07 18:13:42.760727491 +0200
1ee46d
+++ cvsps-2.2b1_/cvsps.c	2010-09-07 18:05:11.083729441 +0200
1ee46d
@@ -1065,17 +1065,16 @@ static CvsFile * parse_file(const char *
1ee46d
 {
1ee46d
     CvsFile * retval;
1ee46d
     char fn[PATH_MAX];
1ee46d
-    int len = strlen(buff + 10);
1ee46d
+    size_t len = strlen(buff + 10);
1ee46d
     char * p;
1ee46d
 
1ee46d
     /* once a single file has been parsed ok we set this */
1ee46d
     static int path_ok;
1ee46d
-    
1ee46d
+
1ee46d
     /* chop the ",v" string and the "LF" */
1ee46d
     len -= 3;
1ee46d
     memcpy(fn, buff + 10, len);
1ee46d
     fn[len] = 0;
1ee46d
-    
1ee46d
     if (strncmp(fn, strip_path, strip_path_len) != 0)
1ee46d
     {
1ee46d
 	/* if the very first file fails the strip path,
1ee46d
@@ -1096,10 +1095,10 @@ static CvsFile * parse_file(const char *
1ee46d
 
1ee46d
 	    while ((p = strstr(p, repository_path)))
1ee46d
 		lastp = p++;
1ee46d
-      
1ee46d
+
1ee46d
 	    if (lastp)
1ee46d
 	    {
1ee46d
-		int len = strlen(repository_path);
1ee46d
+		size_t len = strlen(repository_path);
1ee46d
 		memcpy(strip_path, fn, lastp - fn + len + 1);
1ee46d
 		strip_path_len = lastp - fn + len + 1;
1ee46d
 		strip_path[strip_path_len] = 0;
1ee46d
@@ -1114,16 +1113,26 @@ static CvsFile * parse_file(const char *
1ee46d
 	 *
1ee46d
 	 * For now just ignore such files
1ee46d
 	 */
1ee46d
-	debug(DEBUG_APPMSG1, "WARNING: file %s doesn't match strip_path %s. ignoring", 
1ee46d
+	debug(DEBUG_APPMSG1, "WARNING: file %s doesn't match strip_path %s. ignoring",
1ee46d
 	      fn, strip_path);
1ee46d
 	return NULL;
1ee46d
     }
1ee46d
 
1ee46d
  ok:
1ee46d
-    path_ok = 1;
1ee46d
-
1ee46d
+     /*
1ee46d
+     fix for rhbz#576076
1ee46d
+     ./cvsps --norc -q --cvs-direct -u -A --root :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot NSS
1ee46d
+     */
1ee46d
+    if(len <= strip_path_len)
1ee46d
+    {
1ee46d
+        debug(DEBUG_APPMSG1, "WARNING: file %s doesn't match strip_path %s. ignoring",
1ee46d
+	      fn, strip_path);
1ee46d
+        return NULL;
1ee46d
+    }
1ee46d
     /* remove from beginning the 'strip_path' string */
1ee46d
     len -= strip_path_len;
1ee46d
+    path_ok = 1;
1ee46d
+
1ee46d
     memmove(fn, fn + strip_path_len, len);
1ee46d
     fn[len] = 0;
1ee46d