aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-08-21 13:20:53 -0700
committerGuy Harris <gharris@sonic.net>2020-08-21 20:21:29 +0000
commitae9f431c0973b106012bdce483bc59970d85877a (patch)
tree2d2478fa6e46243dd5e53dc5241077ebec2278a0 /epan/wmem
parentc542e2476c19142a5e50dcdb006bfd64084fef02 (diff)
wmem_strbuf: add comments asking whether some checks are necessary.
Change-Id: I5a918eba4301aea64c58a8ada89b4daa49fb8c87 Reviewed-on: https://code.wireshark.org/review/38226 Reviewed-by: Guy Harris <gharris@sonic.net>
Diffstat (limited to 'epan/wmem')
-rw-r--r--epan/wmem/wmem_strbuf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/epan/wmem/wmem_strbuf.c b/epan/wmem/wmem_strbuf.c
index 8fb3837f82..f56099af6a 100644
--- a/epan/wmem/wmem_strbuf.c
+++ b/epan/wmem/wmem_strbuf.c
@@ -141,6 +141,10 @@ wmem_strbuf_append(wmem_strbuf_t *strbuf, const gchar *str)
wmem_strbuf_grow(strbuf, append_len);
+ /*
+ * XXX - hasn't wmem_strbuf_grow() ensure there's enough room for
+ * all of str?
+ */
g_strlcpy(&strbuf->str[strbuf->len], str, WMEM_STRBUF_RAW_ROOM(strbuf));
strbuf->len = MIN(strbuf->len + append_len, strbuf->alloc_len - 1);
@@ -216,7 +220,7 @@ wmem_strbuf_append_c(wmem_strbuf_t *strbuf, const gchar c)
{
wmem_strbuf_grow(strbuf, 1);
- /* one for the char, one for the null-terminator */
+ /* XXX - hasn't wmem_strbuf_grow() ensure this to be true? */
if (WMEM_STRBUF_ROOM(strbuf) >= 1) {
strbuf->str[strbuf->len] = c;
strbuf->len++;
@@ -234,6 +238,7 @@ wmem_strbuf_append_unichar(wmem_strbuf_t *strbuf, const gunichar c)
wmem_strbuf_grow(strbuf, charlen);
+ /* XXX - hasn't wmem_strbuf_grow() ensure this to be true? */
if (WMEM_STRBUF_ROOM(strbuf) >= charlen) {
memcpy(&strbuf->str[strbuf->len], buf, charlen);
strbuf->len += charlen;