4 Mar
2024
4 Mar
'24
9:34 a.m.
Hans Leidekker (@hans) commented about dlls/webservices/tests/channel.c:
int offset, dict_buf_size, body_buf_size, dict_size;
/* Session dictionary strings. */ - offset = write_size( dict_buf, strlen(str) ); - memcpy( dict_buf + offset, str, strlen(str) ); - dict_buf_size = strlen(str) + offset; + offset = write_size( dict_buf, strnlen(str, ARRAY_SIZE(dict_buf) - ARRAY_SIZE(dict_size_buf))); + memcpy( dict_buf + offset, str, strnlen(str, ARRAY_SIZE(dict_buf) - ARRAY_SIZE(dict_size_buf)) ); + dict_buf_size = strnlen(str, ARRAY_SIZE(dict_buf) - ARRAY_SIZE(dict_size_buf)) + offset;
Looks good, but a 'max_len' variable would make his more readable. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5203#note_63339