summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libiberty/strstr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libiberty/strstr.c b/libiberty/strstr.c
index 60902ea40ee..e6e70fa6fc7 100644
--- a/libiberty/strstr.c
+++ b/libiberty/strstr.c
@@ -32,6 +32,9 @@ strstr (const char *s1, const char *s2)
const char *p = s1;
const size_t len = strlen (s2);
+ if (!len)
+ return s1;
+
for (; (p = strchr (p, *s2)) != 0; p++)
{
if (strncmp (p, s2, len) == 0)