Closed stenbergd closed 9 years ago
"If src contains n or more bytes, strncat() writes n+1 bytes to dest (n from src plus the terminating null byte). Therefore, the size of dest must be at least strlen(dest)+n+1."
This also goes for strcpy -> strncpy and sprintf -> snprintf
Done.
strncat is used extensively in the USB CDC command line interface.
But it looks like it may be used improperly. The size set is not the max allowed string size, but the max amount of characters that can be added.
This causes a risk if we do not calculate how many bytes left of original string size.