Fixed the port-parsing in an rsync:// path; e.g., this now
authorWayne Davison <wayned@samba.org>
Wed, 1 Aug 2007 22:25:02 +0000 (22:25 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 1 Aug 2007 22:25:02 +0000 (22:25 +0000)
works properly:  rsync://backup@otherbox/module/a:123:b

options.c

index 4331fc6..a404a8d 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1981,7 +1981,7 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
                        if (p[1] == ':')
                                *port_ptr = atoi(p+2);
                } else {
                        if (p[1] == ':')
                                *port_ptr = atoi(p+2);
                } else {
-                       if ((p = strchr(s, ':')) != NULL) {
+                       if ((p = strchr(s, ':')) != NULL && p < s + hostlen) {
                                hostlen = p - s;
                                *port_ptr = atoi(p+1);
                        }
                                hostlen = p - s;
                                *port_ptr = atoi(p+1);
                        }