We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9d025fa + 9cb46a2 commit 1bba685Copy full SHA for 1bba685
src/hal/utils/halcmd.c
@@ -678,10 +678,10 @@ static int strip_comments ( char *buf )
678
679
*/
680
static int strlimcpy(char **dest, char *src, int srclen, int *destspace) {
681
- if (*destspace < srclen) {
+ if (*destspace < srclen+1) {
682
return -1;
683
} else {
684
- strncpy(*dest, src, srclen);
+ strncpy(*dest, src, *destspace);
685
(*dest)[srclen] = '\0';
686
srclen = strlen(*dest); /* use the actual number of bytes copied */
687
*destspace -= srclen;
0 commit comments