From cbc42b9c1668f0c11015c6eceec975b8656063f8 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 18 Dec 2015 14:46:28 -0800 Subject: Don't allow an empty flag name to --info & --debug. --- NEWS | 4 ++++ OLDNEWS | 2 +- options.c | 16 +++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 10719884..740cb340 100644 --- a/NEWS +++ b/NEWS @@ -20,9 +20,13 @@ Changes since 3.1.1: right. - Don't create an empty backup dir for a transferred file that doesn't exist yet. + - Fixed a bug where --link-dest and --xattrs could cause rsync to exit if + a filename had a matching dir of the same name in the alt-dest area. - Allow more than 32 group IDs per user in the daemon's gid=LIST config. - Fix the logging of %b & %c via --log-file (daemon logging was already correct, as was --out-format='%b/%c'). + - Fix erroneous acceptance of --info=5 & --debug=5 (an empty flag name is + not valid). ENHANCEMENTS: diff --git a/OLDNEWS b/OLDNEWS index 5a33d7ae..295ab2e7 100644 --- a/OLDNEWS +++ b/OLDNEWS @@ -3650,7 +3650,7 @@ Changes since 2.4.6: Partial Protocol History RELEASE DATE VER. DATE OF COMMIT* PROTOCOL - ?? Aug 2015 3.1.2 31 + ?? Dec 2015 3.1.2 31 22 Jun 2014 3.1.1 31 28 Sep 2013 3.1.0 31 Aug 2008 31 23 Sep 2011 3.0.9 30 diff --git a/options.c b/options.c index 7e93ea1e..74239bf2 100644 --- a/options.c +++ b/options.c @@ -411,16 +411,17 @@ static void parse_output_words(struct output_struct *words, short *levels, const char *s; int j, len, lev; - if (!str) - return; - - while (*str) { + for ( ; str; str = s) { if ((s = strchr(str, ',')) != NULL) len = s++ - str; else len = strlen(str); - while (len && isDigit(str+len-1)) - len--; + if (!len) + continue; + if (!isDigit(str)) { + while (len && isDigit(str+len-1)) + len--; + } lev = isDigit(str+len) ? atoi(str+len) : 1; if (lev > MAX_OUT_LEVEL) lev = MAX_OUT_LEVEL; @@ -448,9 +449,6 @@ static void parse_output_words(struct output_struct *words, short *levels, words[j].help, len, str); exit_cleanup(RERR_SYNTAX); } - if (!s) - break; - str = s; } } -- cgit v1.2.1