lib/util/util.c: In function ‘dump_data_block16’:
lib/util/util.c:503:40: error: ‘%04zX’ directive output may be truncated
writing between 4 and 16 bytes into a region of size 15
[-Werror=format-truncation=]
503 | snprintf(tmp, sizeof(tmp), "%s[%04zX]", prefix, idx);
| ^~~~~
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
void (*cb)(const char *buf, void *private_data),
void *private_data)
{
- char tmp[16];
+ size_t prefix_len = strlen(prefix);
+ /* 16 (=%04zX) + 2 (=[]) + 1 (='\0') => 19 */
+ char tmp[prefix_len + 19];
size_t i;
SMB_ASSERT(len <= 16);