diff options
author | Eric Blake <eblake@redhat.com> | 2011-04-15 20:26:05 +0000 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-04-15 20:26:05 +0000 |
commit | 0fbf39cc9f68159495142339408054d68b2bb7b4 (patch) | |
tree | 39c6ea95f05eaa3bc22307d060d27b6b8fbb1ac0 /newlib/libc/string/strchrnul.c | |
parent | 6f714140b5abb529251094775185659d5fed54a4 (diff) | |
download | cygnal-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.c | 4 |
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); } |