GCC warns (-Wstringop-truncation) because the destination buffer size is identical to max-size, leading to a potential char[] with no null terminator. nanopb can handle it fine, and parantheses around strncpy silence that compiler warning. nanopb treatment of string buffers with specific max length seems dangerous in general, specifically when read from, but this particular case should be correct, as the buffer is only ever read by nanopb itself, which takes the max size into consideration, in addition to the null terminator.pull/19198/head
parent
32a37e235a
commit
8fa95462a1
2 changed files with 12 additions and 4 deletions
Loading…
Reference in new issue