summaryrefslogtreecommitdiffstats
path: root/src/libudev/libudev-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-02-26 12:37:40 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-02-26 12:37:40 +0100
commit92e068b465299d5d88fe480bc5cf2bf4bd750516 (patch)
treec1156c20ae1252a6482996a3f6bc6bfb6a0da9de /src/libudev/libudev-util.c
parentbasic/utf8: change type of function to emphasize that it only looks at one ch... (diff)
downloadsystemd-92e068b465299d5d88fe480bc5cf2bf4bd750516.tar.xz
systemd-92e068b465299d5d88fe480bc5cf2bf4bd750516.zip
basic/utf8: do not read past end of string when looking for a multi-byte character
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9341.
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r--src/libudev/libudev-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 7e21719fbf..37660d0313 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -175,7 +175,7 @@ size_t util_replace_chars(char *str, const char *white) {
}
/* accept valid utf8 */
- len = utf8_encoded_valid_unichar(&str[i]);
+ len = utf8_encoded_valid_unichar(str + i, (size_t) -1);
if (len > 1) {
i += len;
continue;