aboutsummaryrefslogtreecommitdiff
path: root/newlib
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
parent6f714140b5abb529251094775185659d5fed54a4 (diff)
downloadnewlib-0fbf39cc9f68159495142339408054d68b2bb7b4.zip
newlib-0fbf39cc9f68159495142339408054d68b2bb7b4.tar.gz
newlib-0fbf39cc9f68159495142339408054d68b2bb7b4.tar.bz2
strchrnul: avoid segv
* libc/string/strchrnul.c (strchrnul): Fix strchrnul.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog4
-rw-r--r--newlib/libc/string/strchrnul.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index f10416b..ca8b92c 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-15 Eric Blake <eblake@redhat.com>
+
+ * libc/string/strchrnul.c (strchrnul): Fix strchrnul.
+
2011-03-27 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* libc/include/string.h (strchrnul): Declare.
diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c
index 59c7311..afeef43 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);
}