diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-21 04:52:24 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-21 05:08:59 +0200 |
commit | b08cf6c29f94373823a910e015c62d437f83dbfd (patch) | |
tree | 23a5fc7979f05d625b42d921b27accd0f6434094 /liberty.c | |
parent | 69101eb1554ad2fca6de30cdbaccac076210d7e3 (diff) | |
download | liberty-b08cf6c29f94373823a910e015c62d437f83dbfd.tar.gz liberty-b08cf6c29f94373823a910e015c62d437f83dbfd.tar.xz liberty-b08cf6c29f94373823a910e015c62d437f83dbfd.zip |
Reject overlong UTF-8 sequences
Diffstat (limited to 'liberty.c')
-rw-r--r-- | liberty.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -2753,6 +2753,11 @@ utf8_decode (const char **s, size_t len) // Check the rest of the sequence uint32_t cp = *p++ & ~mask; + + // Overlong sequence (possibly MUTF-8, not supported) + if (!cp && sequence_len) + return -1; + while (sequence_len && --sequence_len) { if (p == end) |