about summary refs log tree commit diff
path: root/string
diff options
context:
space:
mode:
Diffstat (limited to 'string')
-rw-r--r--string/test-memchr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/string/test-memchr.c b/string/test-memchr.c
index c233ead5dd..cd9a01e3da 100644
--- a/string/test-memchr.c
+++ b/string/test-memchr.c
@@ -1,5 +1,5 @@
 /* Test and measure memchr functions.
-   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -144,7 +144,12 @@ do_random_tests (void)
 	}
 
       if (pos < len)
-	result = (char *) (p + pos + align);
+	{
+	  size_t r = random ();
+	  if ((r & 31) == 0)
+	    len = ~(uintptr_t) (p + align) - ((r >> 5) & 31);
+	  result = (char *) (p + pos + align);
+	}
       else
 	result = NULL;