The branch, master has been updated
       via  bff3ac2 s3-passdb: Fix string duplication to pointers.
       via  541164d wbinfo: Fix a memory leak in wbinfo_ping_dc().
       via  c8371b4 s3-libads: Fix memory leaks in ads_build_path().
       via  615efa4 lib: Fix strict-aliasing warning in md5 code.
      from  044f8f7 group_mapping: Avoid a talloc

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


- Log -----------------------------------------------------------------
commit bff3ac250e9d4e7d91820eb53c28257aa38fff88
Author: Andreas Schneider <[email protected]>
Date:   Thu Jan 9 15:20:21 2014 +0100

    s3-passdb: Fix string duplication to pointers.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Günther Deschner <[email protected]>
    
    Autobuild-User(master): Andreas Schneider <[email protected]>
    Autobuild-Date(master): Thu Jan  9 22:35:25 CET 2014 on sn-devel-104

commit 541164d47a86bab90ef96a9be40b8c0997abdd61
Author: Andreas Schneider <[email protected]>
Date:   Thu Jan 9 15:12:24 2014 +0100

    wbinfo: Fix a memory leak in wbinfo_ping_dc().
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Günther Deschner <[email protected]>

commit c8371b4ec12f2dea6ce18724de59a23e04826c1d
Author: Andreas Schneider <[email protected]>
Date:   Thu Jan 9 15:06:14 2014 +0100

    s3-libads: Fix memory leaks in ads_build_path().
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Günther Deschner <[email protected]>

commit 615efa4ae84373ae8aefb36fcf7583338665429a
Author: Andreas Schneider <[email protected]>
Date:   Thu Jan 9 14:50:18 2014 +0100

    lib: Fix strict-aliasing warning in md5 code.
    
    If the compiler detects strict aliasing problems it isn't able to
    optimize the code.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Günther Deschner <[email protected]>

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

Summary of changes:
 lib/crypto/md5.c            |    9 ++++++---
 nsswitch/wbinfo.c           |    1 +
 source3/libads/ads_struct.c |    2 ++
 source3/passdb/py_passdb.c  |   14 ++++++++++++--
 4 files changed, 21 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/crypto/md5.c b/lib/crypto/md5.c
index b834c91..352f80f 100644
--- a/lib/crypto/md5.c
+++ b/lib/crypto/md5.c
@@ -137,9 +137,12 @@ _PUBLIC_ void MD5Final(uint8_t digest[16], MD5_CTX *ctx)
     }
     byteReverse(ctx->in, 14);
 
-    /* Append length in bits and transform */
-    ((uint32_t *) ctx->in)[14] = ctx->bits[0];
-    ((uint32_t *) ctx->in)[15] = ctx->bits[1];
+    /* Append length in bits and transform.
+     * Use memcpy to avoid strict-aliasing problems.
+     * This way it can be optimized.
+     */
+    memcpy(&ctx->in[14 * sizeof(uint32_t)], &ctx->bits[0], sizeof(uint32_t));
+    memcpy(&ctx->in[15 * sizeof(uint32_t)], &ctx->bits[1], sizeof(uint32_t));
 
     MD5Transform(ctx->buf, (uint32_t *) ctx->in);
     byteReverse((uint8_t *) ctx->buf, 4);
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index cc75fc3..bc25a17 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -838,6 +838,7 @@ static bool wbinfo_ping_dc(void)
                 dcname ? dcname : "",
                 WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed");
 
+       wbcFreeMemory(dcname);
        if (wbc_status == WBC_ERR_AUTH_ERROR) {
                d_fprintf(stderr, "error code was %s (0x%x)\n",
                          error->nt_string, error->nt_status);
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index fd7e417..30d433e 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -55,12 +55,14 @@ char *ads_build_path(const char *realm, const char *sep, 
const char *field, int
        if (strlcpy(ret,field, len) >= len) {
                /* Truncate ! */
                free(r);
+               free(ret);
                return NULL;
        }
        p=strtok_r(r, sep, &saveptr);
        if (p) {
                if (strlcat(ret, p, len) >= len) {
                        free(r);
+                       free(ret);
                        return NULL;
                }
 
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index 87dbb5d..2d3b637 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -2265,8 +2265,18 @@ static PyObject *py_pdb_set_aliasinfo(pytalloc_Object 
*self, PyObject *args)
 
        alias_sid = pytalloc_get_ptr(py_alias_sid);
 
-       fstrcpy(alias_info.acct_name, 
PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_name")));
-       fstrcpy(alias_info.acct_desc, 
PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_desc")));
+       alias_info.acct_name = talloc_strdup(frame, 
PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_name")));
+       if (alias_info.acct_name == NULL) {
+               PyErr_Format(py_pdb_error, "Unable to allocate memory");
+               talloc_free(frame);
+               return NULL;
+       }
+       alias_info.acct_desc = talloc_strdup(frame, 
PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_desc")));
+       if (alias_info.acct_desc == NULL) {
+               PyErr_Format(py_pdb_error, "Unable to allocate memory");
+               talloc_free(frame);
+               return NULL;
+       }
 
        status = methods->set_aliasinfo(methods, alias_sid, &alias_info);
        if (!NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository

Reply via email to