From: Wayne Davison Date: Sun, 16 Dec 2018 00:52:53 +0000 (-0800) Subject: Avoid a potential out-of-bounds read in daemon mode if argc is 0. X-Git-Tag: v3.2.0pre1~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3668685354e7457ac3e29634083906ee5435bf2;p=thirdparty%2Frsync.git Avoid a potential out-of-bounds read in daemon mode if argc is 0. --- diff --git a/NEWS b/NEWS index 1bcdba72..de493a05 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ Changes since 3.1.3: BUG FIXES: + - Avoid a potential out-of-bounds read in daemon mode if argc can be made + to become 0. + - Fix xattr filter rules losing an 'x' attribute in a non-local transfer. - Fix a compiler error/warning about shifting a negative value (in the zlib diff --git a/options.c b/options.c index 1c5b42d0..a07c8e13 100644 --- a/options.c +++ b/options.c @@ -1315,6 +1315,10 @@ int parse_arguments(int *argc_p, const char ***argv_p) int opt; int orig_protect_args = protect_args; + if (argc == 0) { + strlcpy(err_buf, "argc is zero!\n", sizeof err_buf); + return 0; + } if (ref && *ref) set_refuse_options(ref); if (am_daemon) {