summaryrefslogtreecommitdiffstats
path: root/newlib/libc/string/strchrnul.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-04-15 20:26:05 +0000
committerEric Blake <eblake@redhat.com>2011-04-15 20:26:05 +0000
commit0fbf39cc9f68159495142339408054d68b2bb7b4 (patch)
tree39c6ea95f05eaa3bc22307d060d27b6b8fbb1ac0 /newlib/libc/string/strchrnul.c
parent6f714140b5abb529251094775185659d5fed54a4 (diff)
downloadcygnal-0fbf39cc9f68159495142339408054d68b2bb7b4.tar.gz
cygnal-0fbf39cc9f68159495142339408054d68b2bb7b4.tar.bz2
cygnal-0fbf39cc9f68159495142339408054d68b2bb7b4.zip
strchrnul: avoid segv
* libc/string/strchrnul.c (strchrnul): Fix strchrnul.
Diffstat (limited to 'newlib/libc/string/strchrnul.c')
-rw-r--r--newlib/libc/string/strchrnul.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c
index 59c7311b9..afeef434e 100644
--- a/newlib/libc/string/strchrnul.c
+++ b/newlib/libc/string/strchrnul.c
@@ -43,7 +43,5 @@ _DEFUN (strchrnul, (s1, i),
{
char *s = strchr(s1, i);
- if (*s != NULL)
- return s;
- return (char *)s1 + strlen(s1);
+ return s ? s : (char *)s1 + strlen(s1);
}