# HG changeset patch # User Simon Josefsson # Date 1243344713 -7200 # Node ID 8864003db4222b4ab57b6e29ebbf556b10f16582 # Parent 3a0825087a5c90a4d173ebcb9aebf8fd4f58e8ee tests/test-strstr.c: Rewrite to use malloc/strcpy instead of strdup. Suggested by Eric Blake . diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2009-05-26 Simon Josefsson * tests/test-strstr.c: Add another self-test. + * tests/test-strstr.c: Rewrite to use malloc/strcpy instead of + strdup. Suggested by Eric Blake . 2009-05-23 Bruno Haible diff --git a/tests/test-strstr.c b/tests/test-strstr.c --- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -62,8 +62,12 @@ { /* See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 */ - char *input = strdup ("aBaaaaaaaaaaax"); - const char *result = strstr (input, "B1x"); + const char *fix = "aBaaaaaaaaaaax"; + char *input = malloc (strlen (fix) + 1); + const char *result; + + strcpy (input, fix); + result = strstr (input, "B1x"); ASSERT (result == NULL); free (input); }