- Changed strncpy to strlcpy, strncat to strlcat
- Added strlcpy and strlcat to SICS - Added a driver for the POLDI power supplies
This commit is contained in:
@ -99,7 +99,7 @@ static int EL737Command(pEL737hp pPriv, char *pCommand,
|
||||
*/
|
||||
if (strstr(pReply, "*") != NULL) {
|
||||
memset(pPriv->savedStarMessage, 0, 20);
|
||||
strncpy(pPriv->savedStarMessage, pReply, 19);
|
||||
strlcpy(pPriv->savedStarMessage, pReply, 19);
|
||||
pPriv->haveSavedStarMessage = 1;
|
||||
status = readRS232TillTerm(pPriv->controller, pReply, &savedLen);
|
||||
if (status < 0) {
|
||||
@ -332,31 +332,31 @@ static int EL737GetError(struct __COUNTER *self, int *iCode,
|
||||
*iCode = pPriv->errorCode;
|
||||
switch (pPriv->errorCode) {
|
||||
case OFFLINE:
|
||||
strncpy(pError, "EL737 is offline", errLen);
|
||||
strlcpy(pError, "EL737 is offline", errLen);
|
||||
break;
|
||||
case BADRANGE:
|
||||
strncpy(pError, "EL737 parameter is out of range", errLen);
|
||||
strlcpy(pError, "EL737 parameter is out of range", errLen);
|
||||
break;
|
||||
case BADCOMMAND:
|
||||
strncpy(pError, "EL737 received unknown command or is busy", errLen);
|
||||
strlcpy(pError, "EL737 received unknown command or is busy", errLen);
|
||||
break;
|
||||
case BADPARAM:
|
||||
strncpy(pError, "EL737 parameter is awful", errLen);
|
||||
strlcpy(pError, "EL737 parameter is awful", errLen);
|
||||
break;
|
||||
case NOPARAM:
|
||||
strncpy(pError, "EL737 parameter missing", errLen);
|
||||
strlcpy(pError, "EL737 parameter missing", errLen);
|
||||
break;
|
||||
case TOMANYCOUNTS:
|
||||
strncpy(pError, "EL737 counters overflowed", errLen);
|
||||
strlcpy(pError, "EL737 counters overflowed", errLen);
|
||||
break;
|
||||
case SYSERROR:
|
||||
strncpy(pError, "EL737 has an internal system error", errLen);
|
||||
strlcpy(pError, "EL737 has an internal system error", errLen);
|
||||
break;
|
||||
case BADREPLY:
|
||||
strncpy(pError, "EL737 sent an unexpected reply", errLen);
|
||||
strlcpy(pError, "EL737 sent an unexpected reply", errLen);
|
||||
break;
|
||||
case SELECTFAIL:
|
||||
strncpy(pError, "select system call failed, network trouble", errLen);
|
||||
strlcpy(pError, "select system call failed, network trouble", errLen);
|
||||
default:
|
||||
getRS232Error(pPriv->errorCode, pError, errLen);
|
||||
}
|
||||
@ -516,7 +516,7 @@ pCounterDriver MakeEL737HPV2(SConnection * pCon, char *name,
|
||||
return NULL;
|
||||
}
|
||||
port = atoi(argv[1]);
|
||||
strncpy(pHost, argv[0], 131);
|
||||
strlcpy(pHost, argv[0], 131);
|
||||
|
||||
/*
|
||||
allocate a bank worth of memory ...........
|
||||
|
Reference in New Issue
Block a user