diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-09-30 13:57:23 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-09-30 13:57:23 -0700 |
commit | 2c978bbfa92b7fe29c17e40ad6d8059814b78399 (patch) | |
tree | 56dd136cd3a6ed8873d9a0fb4faa8b868d19ead4 | |
parent | 69fe3a5ddd6af872bc686ff2161b9b6a5e5c62a2 (diff) | |
download | samba-2c978bbfa92b7fe29c17e40ad6d8059814b78399.tar.gz samba-2c978bbfa92b7fe29c17e40ad6d8059814b78399.tar.bz2 samba-2c978bbfa92b7fe29c17e40ad6d8059814b78399.zip |
handle NULL strings in strchr_m() and strrchr_m()
This is needed for the LSA server code which needs to cope with a NULL
names passed to lsa_LookupNames3()
-rw-r--r-- | source4/lib/charset/util_unistr.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c index a8ff88423a..5f3b2c53f1 100644 --- a/source4/lib/charset/util_unistr.c +++ b/source4/lib/charset/util_unistr.c @@ -386,6 +386,9 @@ _PUBLIC_ size_t strlen_m_term(const char *s) **/ _PUBLIC_ char *strchr_m(const char *s, char c) { + if (s == NULL) { + return NULL; + } /* characters below 0x3F are guaranteed to not appear in non-initial position in multi-byte charsets */ if ((c & 0xC0) == 0) { @@ -411,6 +414,10 @@ _PUBLIC_ char *strrchr_m(const char *s, char c) { char *ret = NULL; + if (s == NULL) { + return NULL; + } + /* characters below 0x3F are guaranteed to not appear in non-initial position in multi-byte charsets */ if ((c & 0xC0) == 0) { |