rsync-2.5.4:backup.c possible bug

Mike Rubel mrubel at galcit.caltech.edu
Wed Mar 27 17:46:47 EST 2002


Hello,

I suspect a minor bug in the file rsync-2.5.4/backup.c line 206.
To identify too-long pathnames, it makes the following test:

if (strlen(backup_dir) + strlen(fname) > (MAXPATHLEN - 1))

I think that the constant subtracted off should be 2, to account both for
the forward-slash and for the trailing zero in the following snprintf
statement, line 211:

snprintf(keep_name, sizeof (keep_name), "%s/%s", backup_dir, fname);

Notice that (line 178) keep_name is an array of MAXPATHLEN characters.

Another (perhaps more logical) possible fix would be to make keep_name
MAXPATHLEN+1 characters long.  It depends whether MAXPATHLEN was intended
to count the trailing zero or not.  On my linux machine, MAXPATHLEN is
4095, so I assume that it was not.

I sent this to the web bug-submission form about a week and a half ago,
but haven't heard anything since then, so I'm forwarding it on to the list
here.  Please let me know if there's a more appropriate place to send
it!

Thanks,
Mike





More information about the rsync mailing list