Hi Theo,
Thanks for the feedback, good catch on 'len'! Following your suggestions
- how about the below?
Kind regards,
Job
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/rsync/main.c,v
retrieving revision 1.65
diff -u -p -r1.65 main.c
--- main.c 2 Aug 2022 20:01:12 -0000 1.65
+++ main.c 14 Feb 2023 16:55:43 -0000
@@ -231,17 +231,21 @@ fargs_parse(size_t argc, char *argv[], s
j = strlen(cp);
if (f->remote &&
strncasecmp(cp, "rsync://", 8) == 0) {
- /* rsync://path */
+ /* rsync://host[:port]/path */
+ size_t module_offset = len;
cp += 8;
- if ((ccp = strchr(cp, ':'))) /* skip :port */
+ /* skip :port */
+ if ((ccp = strchr(cp, ':')) != NULL) {
*ccp = '\0';
+ module_offset += strcspn(ccp + 1, "/") + 1;
+ }
if (strncmp(cp, f->host, len) ||
(cp[len] != '/' && cp[len] != '\0'))
errx(ERR_SYNTAX, "different remote host: %s",
f->sources[i]);
memmove(f->sources[i],
- f->sources[i] + len + 8 + 1,
- j - len - 8);
+ f->sources[i] + module_offset + 8 + 1,
+ j - module_offset - 8);
} else if (f->remote && strncmp(cp, "::", 2) == 0) {
/* ::path */
memmove(f->sources[i],