projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f9aa541
)
utf8: when looking at the next unichar, honour the size parameter, in utf8_is_printab...
author
Lennart Poettering
<lennart@poettering.net>
Fri, 7 Nov 2014 15:34:00 +0000
(16:34 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Fri, 7 Nov 2014 15:36:14 +0000
(16:36 +0100)
src/shared/utf8.c
patch
|
blob
|
history
diff --git
a/src/shared/utf8.c
b/src/shared/utf8.c
index
9353559
..
8702ceb
100644
(file)
--- a/
src/shared/utf8.c
+++ b/
src/shared/utf8.c
@@
-150,10
+150,12
@@
bool utf8_is_printable_newline(const char* str, size_t length, bool newline) {
int encoded_len, val;
encoded_len = utf8_encoded_valid_unichar((const char *) p);
- val = utf8_encoded_to_unichar((const char*) p);
-
if (encoded_len < 0 ||
- val < 0 ||
+ (size_t) encoded_len > length)
+ return false;
+
+ val = utf8_encoded_to_unichar((const char*) p);
+ if (val < 0 ||
is_unicode_control(val) ||
(!newline && val == '\n'))
return false;