r18800: fix a write behind the buffer bug...
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Sep 2006 22:55:00 +0000 (22:55 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:19:12 +0000 (14:19 -0500)
Thanks Herb for finding this:-)

This was my bug, I typed it in on gd's laptop and he just run 'svn ci'

metze
(This used to be commit 3c08e29f4fdde586084bdcf1b36eaf92ae944750)

source4/torture/rpc/samr.c

index f9bd25dc37bd76c8a28d8cc1f3d25793dcfd1667..b387ec70bf3b1f6be5ff7a49f62a90b1f38ade51 100644 (file)
@@ -1887,10 +1887,8 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                char *v = generate_random_str(mem_ctx, 1);
                int i;
 
-               for (i=0; i <ARRAY_SIZE(simple_pass); i++) {
-                       simple_pass[i] = *v;
-               }
-               simple_pass[i] = '\0';
+               ZERO_STRUCT(simple_pass);
+               memset(simple_pass, *v, sizeof(simple_pass) - 1);
 
                /* test what happens when picking a simple password */
                if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, simple_pass, 0, True)) {