Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-04-16 00:26:05 +0400
committerEric Blake <eblake@redhat.com>2011-04-16 00:26:05 +0400
commit0fbf39cc9f68159495142339408054d68b2bb7b4 (patch)
tree39c6ea95f05eaa3bc22307d060d27b6b8fbb1ac0 /newlib
parent6f714140b5abb529251094775185659d5fed54a4 (diff)
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 f10416bc0..ca8b92cff 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 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);
}