- After a bug at TRICS I replaced all occurrences of strcpy, strcat, sprintf
by length limited versions wherever appropriate. SKIPPED: psi/el755driv.c psi/faverage.c psi/frame.c psi/lmd200.c psi/polterwrite.c psi/psi.c psi/sanswave.c psi/sinqhmdriv.c psi/termprot.c
This commit is contained in:
14
nread.c
14
nread.c
@@ -259,7 +259,7 @@ static int NetReadRead(pNetRead self, pNetItem pItem)
|
||||
sscanf(pPtr, "%s %d", pMuell, &iInt);
|
||||
if (SCMatchRights(pItem->pCon, usUser)) {
|
||||
TaskSignal(self->pMain->pTasker, SICSINT, &iInt);
|
||||
sprintf(pBueffel, "INTERRUPT %d issued on sock %d",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "INTERRUPT %d issued on sock %d",
|
||||
iInt, pItem->pCon->pSock->sockid);
|
||||
WriteToCommandLog("SYS>", pBueffel);
|
||||
if (iInt == eEndServer) {
|
||||
@@ -289,7 +289,7 @@ static int NetReadRead(pNetRead self, pNetItem pItem)
|
||||
*pEnd = '\0';
|
||||
/* do we have something in hold ? */
|
||||
if (strlen(pItem->pHold) > 0) {
|
||||
strcat(pItem->pHold, pPtr);
|
||||
strncat(pItem->pHold, pPtr,511);
|
||||
iStat = CostaTop(pItem->pCon->pStack, pItem->pHold);
|
||||
if (!iStat) {
|
||||
SCWrite(pItem->pCon, "ERROR: Busy", eError);
|
||||
@@ -320,7 +320,7 @@ static int NetReadRead(pNetRead self, pNetItem pItem)
|
||||
}
|
||||
/* when we are here we may still have an incomplete command pending */
|
||||
if (pEnd != pPtr && strlen(pPtr) > 0) {
|
||||
strcpy(pItem->pHold, pPtr);
|
||||
strncpy(pItem->pHold, pPtr, 511);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ static int TelnetRead(pNetRead self, pNetItem pItem)
|
||||
}
|
||||
}
|
||||
TaskSignal(self->pMain->pTasker, SICSINT, &iInt);
|
||||
sprintf(pError, "INTERRUPT %d issued on sock %d", iInt,
|
||||
snprintf(pError,sizeof(pError)-1, "INTERRUPT %d issued on sock %d", iInt,
|
||||
pItem->pCon->pSock->sockid);
|
||||
WriteToCommandLog("SYS>", pError);
|
||||
if (iInt == eEndServer) {
|
||||
@@ -603,7 +603,7 @@ static int TelnetRead(pNetRead self, pNetItem pItem)
|
||||
|
||||
default:
|
||||
/* There is something wrong here! */
|
||||
sprintf(pError, "ERROR: bad telnet code %d", cChar);
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: bad telnet code %d", cChar);
|
||||
SICSLogWrite(pError, eInternal);
|
||||
pItem->tStatus = tData;
|
||||
break;
|
||||
@@ -673,7 +673,7 @@ int NetReaderTask(void *pData)
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(num, "%d, type %d:", NItem.pSock->sockid, NItem.eType);
|
||||
snprintf(num,sizeof(num)-1, "%d, type %d:", NItem.pSock->sockid, NItem.eType);
|
||||
if (conCount < 100) {
|
||||
DynStringConcat(self->conList, num);
|
||||
}
|
||||
@@ -1263,7 +1263,7 @@ static int ANETTelnetProcess(int handle, void *usData)
|
||||
|
||||
default:
|
||||
/* There is something wrong here! */
|
||||
sprintf(pError, "ERROR: bad telnet code %d", cChar);
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: bad telnet code %d", cChar);
|
||||
SICSLogWrite(pError, eInternal);
|
||||
self->state = tData;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user