Alex Henrie : advapi32/tests: Accept a variable number of x's in some RegEnumValue name overflow tests.

Alexandre Julliard julliard at winehq.org
Mon Dec 27 16:15:03 CST 2021


Module: wine
Branch: master
Commit: b75bd0627ee9152bab2b0e206bd1f40c59ddc8f6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b75bd0627ee9152bab2b0e206bd1f40c59ddc8f6

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Sun Dec 26 23:21:18 2021 -0700

advapi32/tests: Accept a variable number of x's in some RegEnumValue name overflow tests.

Fixes intermittent testbot failures.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/advapi32/tests/registry.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index ca371f73d65..af4ed1e8465 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -545,7 +545,7 @@ static void test_enum_value(void)
     data_count = 20;
     type = 1234;
     strcpy( value, "xxxxxxxxxx" );
-    strcpy( data, "xxxxxxxxxx" );
+    memset( data, 'x', sizeof(data) );
     res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
     ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
     ok( val_count == 3, "val_count set to %d\n", val_count );
@@ -555,15 +555,16 @@ static void test_enum_value(void)
     /* v5.1.2600.0 (XP Home and Professional) does not touch value or data in this case */
     ok( !strcmp( value, "Te" ) || !strcmp( value, "xxxxxxxxxx" ), 
         "value set to '%s' instead of 'Te' or 'xxxxxxxxxx'\n", value );
-    ok( !strcmp( data, "foobar" ) || !strcmp( data, "xxxxxxx" ) || broken( !strcmp( data, "xxxxxxxx" ) && data_count > 7 ),
-        "data set to '%s' instead of 'foobar' or 'xxxxxxx'\n", data );
+    ok( !strcmp( data, "foobar" ) || !strcmp( data, "xxxxxxx" ) ||
+        broken( data_count > 7 && strspn( data, "x" ) == data_count && data[data_count] == 0 ),
+        "data set to '%s' instead of 'foobar' or x's, data_count=%u\n", data, data_count );
 
     /* overflow empty name */
     val_count = 0;
     data_count = 20;
     type = 1234;
     strcpy( value, "xxxxxxxxxx" );
-    strcpy( data, "xxxxxxxxxx" );
+    memset( data, 'x', sizeof(data) );
     res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
     ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
     ok( val_count == 0, "val_count set to %d\n", val_count );
@@ -572,8 +573,9 @@ static void test_enum_value(void)
     ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
     ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
     /* v5.1.2600.0 (XP Home and Professional) does not touch data in this case */
-    ok( !strcmp( data, "foobar" ) || !strcmp( data, "xxxxxxx" ) || broken( !strcmp( data, "xxxxxxxx" ) && data_count > 7 ),
-        "data set to '%s' instead of 'foobar' or 'xxxxxxx'\n", data );
+    ok( !strcmp( data, "foobar" ) || !strcmp( data, "xxxxxxx" ) ||
+        broken( data_count > 7 && strspn( data, "x" ) == data_count && data[data_count] == 0 ),
+        "data set to '%s' instead of 'foobar' or x's, data_count=%u\n", data, data_count );
 
     /* overflow data */
     val_count = 20;




More information about the wine-cvs mailing list