diff options
author | John Thacker <johnthacker@gmail.com> | 2020-09-17 15:27:26 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2020-10-15 21:48:28 +0000 |
commit | 91b792c6dca364889e3601ca808ef95bbc65c9de (patch) | |
tree | c310eef77e958fe3685e29d6553d4a7825242c5c /epan/wmem/wmem_strbuf.h | |
parent | 8b622bffc80ec0fbafe37864205dfb63ec33f3ca (diff) |
Replace ill-formed UTF-8 byte sequences with replacement character
Implement the Unicode Standard "best practices" for replacing ill-formed
sequences with the Unicode REPLACEMENT CHARACTER. Add wmem_strbuf_append_len
for appending strings with embedded null characters. Clarify why
wmem_strbuf_grow() doesn't always ensure that there's enough room for
a new string, and short-circuit some tests there. Related to #14948
Diffstat (limited to 'epan/wmem/wmem_strbuf.h')
-rw-r--r-- | epan/wmem/wmem_strbuf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/epan/wmem/wmem_strbuf.h b/epan/wmem/wmem_strbuf.h index 855c02606a..d2f4b3bb2e 100644 --- a/epan/wmem/wmem_strbuf.h +++ b/epan/wmem/wmem_strbuf.h @@ -52,6 +52,13 @@ WS_DLL_PUBLIC void wmem_strbuf_append(wmem_strbuf_t *strbuf, const gchar *str); +/* Appends up to append_len bytes (as allowed by strbuf->max_len) from + * str. Ensures that strbuf is null terminated afterwards but will copy + * embedded nulls. */ +WS_DLL_PUBLIC +void +wmem_strbuf_append_len(wmem_strbuf_t *strbuf, const gchar *str, gsize append_len); + WS_DLL_PUBLIC void wmem_strbuf_append_printf(wmem_strbuf_t *strbuf, const gchar *format, ...) |