Commit f0143f9
committed
Fix String::remove warning
Replace strncpy() usage in String::remove method by memmove().
Destination and source shall not overlap when using strncpy() while
memmove() is safer alternative when overlapping.
Warning raised after moved from arm-none-eabi-gcc 6-2017-q2-update
to 8-2018-q4-major:
cores\arduino\WString.cpp: In member function 'void String::remove(unsigned int, unsigned int)':
cores\arduino\WString.cpp:832:10: warning: 'char* strncpy(char*, const char*, size_t)' accessing 0 or more bytes at offsets [0, 2147483647] and [0, 2147483647] may overlap up to 4294967295 bytes at offset [6442450941, 2147483647] [-Wrestrict]
strncpy(writeTo, buffer + index + count, len - index);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Frederic Pillon <[email protected]>1 parent 49eb0b8 commit f0143f9
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
832 | | - | |
| 832 | + | |
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
| |||
0 commit comments