summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-02-07 22:20:35 +0100
committerGravatar waker <wakeroid@gmail.com>2011-02-07 22:20:35 +0100
commit38e883f1fbc97fc33a01af93cd0a82f971390b51 (patch)
tree5ee065eb2a69f4d19473a49de605bb5c4d4460dd /utf8.c
parent083e9b711cdd5f255e09dfb040a9fd93e97c1774 (diff)
fixed junklib utf8 validation
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/utf8.c b/utf8.c
index bb115e64..c303b9a1 100644
--- a/utf8.c
+++ b/utf8.c
@@ -590,14 +590,13 @@ int u8_valid (const char *str,
/* See that we covered the entire length if a length was
* passed in, or that we ended on a nul if not
*/
- if (max_len >= 0 &&
- p != (str + max_len))
+ if (max_len >= 0 && p != (str + max_len) && *p != 0) {
return 0;
- else if (max_len < 0 &&
- *p != '\0')
+ }
+ else if (max_len < 0 && *p != '\0') {
return 0;
- else
- return 1;
+ }
+ return 1;
}
#if 0