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>
This commit is contained in:
parent
c542e2476c
commit
ae9f431c09
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue