- fixed some potential bugs with strlcpy
This commit is contained in:
@ -108,12 +108,12 @@ static int sinqHttpCheckResponse(pSinqHttp self)
|
||||
}
|
||||
if (strstr(pPtr, "ERROR") != NULL) {
|
||||
memset(self->hmError, 0, 512 * sizeof(char));
|
||||
strlcpy(self->hmError, pPtr, len);
|
||||
strlcpy(self->hmError, pPtr, sizeof(self->hmError));
|
||||
self->errorCode = HTTPERROR;
|
||||
return 0;
|
||||
} else if (strstr(pPtr, "Authentication Error") != NULL) {
|
||||
memset(self->hmError, 0, 512 * sizeof(char));
|
||||
strlcpy(self->hmError, pPtr, len);
|
||||
strlcpy(self->hmError, pPtr, sizeof(self->hmError));
|
||||
self->errorCode = BADAUTH;
|
||||
return 0;
|
||||
}
|
||||
|
2
sps.c
2
sps.c
@ -450,7 +450,7 @@ int SPSGetADC(pSPS self, int iWhich, int *iValue)
|
||||
pPtr++;
|
||||
for (i = 0; i < 8; i++) {
|
||||
pPtr++; /* skip whitespace */
|
||||
strlcpy(pNum, pPtr, 5);
|
||||
strncpy(pNum, pPtr, 5); /* strlcpy probably wrong here */
|
||||
pNum[5] = '\0';
|
||||
pPtr += 5;
|
||||
iADC[i] = atoi(pNum);
|
||||
|
@ -334,7 +334,7 @@ int DornierSend(void **pData, char *pCommand, char *pReply, int iRepLen)
|
||||
if (*pPtr == '\0') { /* no command */
|
||||
return NOCOMMAND;
|
||||
}
|
||||
strlcpy(pOldCom, pPtr, 3);
|
||||
strncpy(pOldCom, pPtr, 3); /* strlcpy probably wrong here */
|
||||
|
||||
iRet = SerialWriteRead(pData, pCommand, pReply, iRepLen);
|
||||
/*
|
||||
|
Reference in New Issue
Block a user