rsync-2.6.9pre2: undeclared variable in source code

Wayne Davison wayned at samba.org
Mon Oct 16 18:06:44 GMT 2006


On Mon, Oct 16, 2006 at 08:11:40AM -0600, Nelson H. F. Beebe wrote:
> A build of rsync-2.6.9pre2 on DEC Alpha OSF/1 4.0 failed because of
> an undeclared variable at lib/inet_ntop.c:84:
> 
> 	memcpy(dst, tmp, len + 1);

I apparently left out the code that set "len".  The attached patch
fixes this.

> ----- daemon-gzip-download rsyncd.log ends
> FAIL    daemon-gzip-download
> ----- daemon-gzip-upload rsyncd.log ends
> FAIL    daemon-gzip-upload

If you'd email me (not the list) the output from the testtmp.*/*log
files, I'll take a look at what they indicate.

..wayne..
-------------- next part --------------
--- lib/inet_ntop.c	13 Oct 2006 23:17:37 -0000	1.4
+++ lib/inet_ntop.c	16 Oct 2006 17:53:43 -0000
@@ -75,9 +75,10 @@ inet_ntop4(const unsigned char *src, cha
 {
 	static const char *fmt = "%u.%u.%u.%u";
 	char tmp[sizeof "255.255.255.255"];
+	size_t len;
 
-	if ((size_t)sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) >= size)
-	{
+	len = snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]);
+	if (len >= size) {
 		errno = ENOSPC;
 		return (NULL);
 	}


More information about the rsync mailing list