Avoid a potential out-of-bounds read in daemon mode if argc is 0.
authorWayne Davison <wayned@samba.org>
Sun, 16 Dec 2018 00:52:53 +0000 (16:52 -0800)
committerWayne Davison <wayned@samba.org>
Sun, 16 Dec 2018 00:59:18 +0000 (16:59 -0800)
NEWS
options.c

diff --git a/NEWS b/NEWS
index 1bcdba723150e6f3d0cdcdd9589136e7f2a17e85..de493a05063bb3a3222192489cbfcbb0f730662d 100644 (file)
--- 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
index 1c5b42d052cd9f7fff9e1e89ccf1bf43a3230812..a07c8e13740e1a373d5e5993b10b65f13f3ef6fb 100644 (file)
--- 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) {