Fix gcc warning 'stringop-truncation'

This commit is contained in:
2026-01-09 12:05:07 +01:00
parent 422182d672
commit 9748cbd394
9 changed files with 24 additions and 21 deletions
+1 -1
View File
@@ -867,7 +867,7 @@ cvtArg (const char *filename, int lineno, char *arg, iocshArgBuf *argBuf,
showError(filename, lineno, ANSI_RED("Out of memory!"));
return 0;
}
strncpy(argBuf->sval, arg, slen);
memcpy(argBuf->sval, arg, slen + 1);
} else {
argBuf->sval = NULL;
}
+2 -2
View File
@@ -256,7 +256,7 @@ size_t epicsStdCall epicsTimeToStrftime (char *pBuff, size_t bufLength, const ch
if ( tmpLen >= bufLenLeft ) {
tmpLen = bufLenLeft - 1;
}
strncpy ( pBufCur, pOVF, tmpLen );
memcpy ( pBufCur, pOVF, tmpLen );
pBufCur[tmpLen] = '\0';
pBufCur += tmpLen;
bufLenLeft -= tmpLen;
@@ -268,7 +268,7 @@ size_t epicsStdCall epicsTimeToStrftime (char *pBuff, size_t bufLength, const ch
if ( tmpLen >= bufLenLeft ) {
tmpLen = bufLenLeft - 1;
}
strncpy ( pBufCur, pDoesntFit, tmpLen );
memcpy ( pBufCur, pDoesntFit, tmpLen );
pBufCur[tmpLen] = '\0';
pBufCur += tmpLen;
bufLenLeft -= tmpLen;
+1 -1
View File
@@ -73,7 +73,7 @@ unsigned epicsStdCall sockAddrToA (
return len;
}
else {
strncpy ( pBuf, "<Ukn Addr Type>", bufSize-1 );
memcpy ( pBuf, pErrStr, bufSize-1 );
pBuf[bufSize-1] = '\0';
return bufSize-1;
}