torture: allow us to correctly use sizeof(buf) in raw.open tests
authorAndrew Bartlett <abartlet@samba.org>
Tue, 2 Sep 2014 02:28:04 +0000 (14:28 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 7 Sep 2014 23:14:53 +0000 (11:14 +1200)
This changes the sizeof(buf) from sizeof(void *), 8 on 64-bit machines, to sizeof("test") (eg 5).

Found by AddressSanitizer

Andrew Bartlett

Change-Id: I01f18b35c041f3b16be9f6da8ae5d1917d7e24d9
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/raw/open.c

index 763c718a98fe1c23157cbb5531ec592765ba4689..679a7c24f7e824e5e78a6e3eaf3b4435890bce87 100644 (file)
@@ -1363,7 +1363,7 @@ static bool test_chained(struct torture_context *tctx, struct smbcli_state *cli)
        NTSTATUS status;
        int fnum = -1;
        bool ret = true;
-       const char *buf = "test";
+       const char buf[] = "test";
        char buf2[4];
 
        torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
@@ -1420,7 +1420,7 @@ static bool test_no_leading_slash(struct torture_context *tctx, struct smbcli_st
        NTSTATUS status;
        int fnum = -1;
        bool ret = true;
-       const char *buf = "test";
+       const char buf[] = "test";
 
        torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
 
@@ -1697,7 +1697,7 @@ static bool test_chained_ntcreatex_readx(struct torture_context *tctx, struct sm
        NTSTATUS status;
        int fnum = -1;
        bool ret = true;
-       const char *buf = "test";
+       const char buf[] = "test";
        char buf2[4];
 
        torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);