[PATCH 07/12] torture: allow us to correctly use sizeof(buf) in raw.open tests

Kamen Mazdrashki kamenim at samba.org
Sun Sep 7 21:25:02 MDT 2014


Reviewed-by: Kamen Mazdrashki <kamenim at samba.org>

On Mon, Sep 8, 2014 at 1:30 AM, <abartlet at samba.org> wrote:

> From: Andrew Bartlett <abartlet at samba.org>
>
> 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 at samba.org>
> ---
>  source4/torture/raw/open.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
> index 763c718..679a7c2 100644
> --- a/source4/torture/raw/open.c
> +++ b/source4/torture/raw/open.c
> @@ -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);
> --
> 2.1.0
>
>


More information about the samba-technical mailing list