diff --git a/libkern/strstr.c b/libkern/strstr.c index 74592a3..022e565 100644 --- a/libkern/strstr.c +++ b/libkern/strstr.c @@ -1,3 +1,5 @@ +/* $NetBSD: strstr.c,v 1.1 2005/12/20 19:28:52 christos Exp $ */ + /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -13,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -50,11 +48,17 @@ * Find the first occurrence of find in s. */ char * -strstr(const char *s, const char *find) +strstr(s, find) + const char *s, *find; { char c, sc; size_t len; + if (BUILTIN_EXPECT(!s, 0)) + return NULL; + if (BUILTIN_EXPECT(!find, 0)) + return NULL; + if ((c = *find++) != 0) { len = strlen(find); do {