The branch, v3-0-test has been updated
       via  01b5cdaac8a92635886a920772f2168734048e16 (commit)
       via  4795fd7d0f7d2eb1528e28f7c5512c24932936eb (commit)
      from  0b98572fa3e7854be8dcb709b85c78c1aea26111 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -----------------------------------------------------------------
commit 01b5cdaac8a92635886a920772f2168734048e16
Author: Volker Lendecke <[EMAIL PROTECTED]>
Date:   Wed Dec 19 16:48:18 2007 +0100

    Some paranoia checks

commit 4795fd7d0f7d2eb1528e28f7c5512c24932936eb
Author: Volker Lendecke <[EMAIL PROTECTED]>
Date:   Wed Dec 19 16:48:04 2007 +0100

    Zero the tdb key, there might be padding
    
    This leads to uninitialized variable warnings if nmbd is run under valgrind.

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

Summary of changes:
 source/libsmb/unexpected.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libsmb/unexpected.c b/source/libsmb/unexpected.c
index 97d6071..0e4e033 100644
--- a/source/libsmb/unexpected.c
+++ b/source/libsmb/unexpected.c
@@ -59,6 +59,8 @@ void unexpected_packet(struct packet_struct *p)
        
        len = build_packet(buf, p);
 
+       ZERO_STRUCT(key);       /* needed for potential alignment */
+
        key.packet_type = p->packet_type;
        key.timestamp = p->timestamp;
        key.count = count++;
@@ -81,6 +83,10 @@ static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, 
TDB_DATA dbuf, void *st
 {
        struct unexpected_key key;
 
+       if (kbuf.dsize != sizeof(key)) {
+               tdb_delete(ttdb, kbuf);
+       }
+
        memcpy(&key, kbuf.dptr, sizeof(key));
 
        if (lastt - key.timestamp > NMBD_UNEXPECTED_TIMEOUT) {
@@ -120,6 +126,10 @@ static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA 
kbuf, TDB_DATA dbuf, void
        struct unexpected_key key;
        struct packet_struct *p;
 
+       if (kbuf.dsize != sizeof(key)) {
+               return 0;
+       }
+
        memcpy(&key, kbuf.dptr, sizeof(key));
 
        if (key.packet_type != match_type) return 0;


-- 
Samba Shared Repository

Reply via email to