- 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:
koennecke
2010-04-13 15:08:40 +00:00
parent 9e4eabeed1
commit dec6b04fa6
49 changed files with 679 additions and 653 deletions

14
A1931.c
View File

@@ -50,7 +50,7 @@ static char *A1931comm(pEVDriver pData, char *command)
/*
send
*/
strncpy(buffer, command, 250);
strlcpy(buffer, command, 250);
strcat(buffer, "\n");
status = GPIBsend(self->gpib, self->devID, buffer, (int) strlen(buffer));
if (status < 0) {
@@ -90,7 +90,7 @@ static char *A1931comm(pEVDriver pData, char *command)
error
*/
self->errorCode = A1931ERROR;
strncpy(self->errorBuffer, pPtr, 131);
strlcpy(self->errorBuffer, pPtr, 131);
free(pPtr);
return NULL;
}
@@ -109,11 +109,11 @@ static int A1931command(pEVDriver pData, char *command, char *replyBuffer,
pReply = A1931comm(pData, command);
if (pReply != NULL) {
strncpy(replyBuffer, pReply, replyBufferLen);
strlcpy(replyBuffer, pReply, replyBufferLen);
free(pReply);
return 1;
} else {
strncpy(replyBuffer, self->errorBuffer, replyBufferLen);
strlcpy(replyBuffer, self->errorBuffer, replyBufferLen);
return 0;
}
}
@@ -195,7 +195,7 @@ static int A1931error(pEVDriver pData, int *iCode, char *errBuff,
*iCode = self->errorCode;
sprintf(pError, "ERROR: %s", self->errorBuffer);
strncpy(errBuff, pError, bufLen);
strlcpy(errBuff, pError, bufLen);
return 1;
}
@@ -287,8 +287,8 @@ static int downloadFile(pA1931 self, FILE * fd)
pPtr = GPIBreadTillTerm(self->gpib, self->devID, 10);
if (pPtr[0] == '#') {
self->errorCode = A1931ERROR;
strncpy(self->errorBuffer, pPtr, 131);
strncpy(self->commandLine, buffer, 131);
strlcpy(self->errorBuffer, pPtr, 131);
strlcpy(self->commandLine, buffer, 131);
free(pPtr);
return 0;
}