The branch, master has been updated
       via  e9495d2ed28 s3-winexe: Fix winexe core dump (use-after-free)
      from  1fce72f796e samba-tool: Add domain member leave

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e9495d2ed28a26899dc3dd77bdfe56e284980218
Author: Günther Deschner <g...@samba.org>
Date:   Thu Nov 4 22:22:44 2021 +0100

    s3-winexe: Fix winexe core dump (use-after-free)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14893
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Günther Deschner <g...@samba.org>
    Autobuild-Date(master): Fri Nov  5 11:43:57 UTC 2021 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 examples/winexe/winexe.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/winexe/winexe.c b/examples/winexe/winexe.c
index 3e0813a4091..59fb9dbdebb 100644
--- a/examples/winexe/winexe.c
+++ b/examples/winexe/winexe.c
@@ -220,8 +220,6 @@ static void parse_args(int argc, const char *argv[],
                *port_str = '\0';
        }
 
-       poptFreeContext(pc);
-
        if (options->runas == NULL && options->runas_file != NULL) {
                struct cli_credentials *runas_cred;
                const char *user;
@@ -253,9 +251,19 @@ static void parse_args(int argc, const char *argv[],
 
        options->credentials = samba_cmdline_get_creds();
 
-       options->hostname = argv_new[0] + 2;
+       options->hostname = talloc_strdup(mem_ctx, argv_new[0] + 2);
+       if (options->hostname == NULL) {
+               DBG_ERR("Out of memory\n");
+               exit(1);
+       }
        options->port = port;
-       options->cmd = argv_new[1];
+       options->cmd = talloc_strdup(mem_ctx, argv_new[1]);
+       if (options->cmd == NULL) {
+               DBG_ERR("Out of memory\n");
+               exit(1);
+       }
+
+       poptFreeContext(pc);
 
        options->flags = flag_interactive;
        if (flag_reinstall) {


-- 
Samba Shared Repository

Reply via email to