Fix gcc warning 'stringop-truncation'
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user