Fix for "Warning: unexpected read size of 0 in map_ptr" in rsync 2.5.2

Dave Dykstra dwd at
Wed Jan 30 08:36:18 EST 2002

I upgraded to rsync 2.5.2 and started to get the error
    Warning: unexpected read size of 0 in map_ptr
when sending just about any file from a Solaris 2.5.1 system to Linux
systems, and then the file that is sent ends up being the wrong size.

Through gdb and trial & error I discovered that if I back out the security
fix in rsync.h at
and recompile match.c on only the sender side then the problem goes away.
Further trial & error resulted in the patch below to fix the problem.

Martin, I think this is probably serious enough to warrant an immediate new

- Dave Dykstra

--- match.c.O	Tue Jan 29 15:31:37 2002
+++ match.c	Tue Jan 29 15:31:54 2002
@@ -246,7 +246,7 @@
 		   match. The 3 reads are caused by the
 		   running match, the checksum update and the
 		   literal send. */
-		if (offset-last_match >= CHUNK_SIZE+s->n && 
+		if (offset-last_match >= CHUNK_SIZE+(int)s->n && 
 		    (end-offset > CHUNK_SIZE)) {
 			matched(f,s,buf,offset - s->n, -2);

More information about the rsync mailing list