forked from osmocom/wireshark
RTPS: Memset entire buffer
Apparently some compilers do sufficient inlining optimization to notice that there's at least one caller of rtps_util_add_typecode which passes an indent_level of 0. Such compilers are *also* picky enough to complain about memset being called with a length of 0, leading to a warning which we turn into a compile error. I thought about putting in an "if indent_level > 0" but I figure memsetting the entire buffer (length >= 1) is simpler and more efficient in the common case. Change-Id: Ica21ba988eb0c1251e7b4ef2e110336d5ee32837 Reviewed-on: https://code.wireshark.org/review/6766 Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
cf142c6b67
commit
b2a5f15fbe
1 changed files with 1 additions and 1 deletions
|
@ -1935,7 +1935,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t * tvb, gint offset
|
||||||
|
|
||||||
/* Calc indent string */
|
/* Calc indent string */
|
||||||
indent_string = (char *)wmem_alloc(wmem_epan_scope(), (indent_level*2)+1);
|
indent_string = (char *)wmem_alloc(wmem_epan_scope(), (indent_level*2)+1);
|
||||||
memset(indent_string, ' ', indent_level*2);
|
memset(indent_string, ' ', (indent_level*2)+1);
|
||||||
indent_string[indent_level*2] = '\0';
|
indent_string[indent_level*2] = '\0';
|
||||||
|
|
||||||
/* Gets TK ID */
|
/* Gets TK ID */
|
||||||
|
|
Loading…
Reference in a new issue