Fix Coverity ID 587
authorVolker Lendecke <vl@sernet.de>
Mon, 1 Sep 2008 11:46:27 +0000 (13:46 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 1 Sep 2008 11:51:11 +0000 (13:51 +0200)
The following test program prints "8" on 64-bit :-)

static void print_size(const char lenbuf[4])
{
        printf("sizeof(lenbuf) = %d\n", (int)sizeof(lenbuf));
}
int main(void)
{
        const char lenbuf[4];
        print_size(lenbuf);
        return 0;
}

Jeremy, please check :-)

Volker

source/smbd/process.c

index 332a2e4da3afb9b90d22c295804b3a5a911f6d5f..b2d19e11e38850cb2701b044a784d42d26a1c5f1 100644 (file)
@@ -164,7 +164,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
        ssize_t toread;
        NTSTATUS status;
 
-       memcpy(writeX_header, lenbuf, sizeof(lenbuf));
+       memcpy(writeX_header, lenbuf, 4);
 
        status = read_socket_with_timeout(
                fd, writeX_header + 4,