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