Fix possible buffer overruns

This commit is contained in:
Douglas Clowes
2014-03-03 17:04:31 +11:00
parent 579b78e30b
commit 0a012cabc3
2 changed files with 3 additions and 5 deletions

View File

@ -346,7 +346,7 @@
/*--------------------------------------------------------------------------*/
int WEST4100_Query(pWEST4100 *pData, int parAddress, int *parValue)
{
unsigned char pCommand[20], pReply[132], pAddress[1];
unsigned char pCommand[20], pReply[132], pAddress[2];
int iRet;
pWEST4100 self;
@ -374,7 +374,7 @@
/* -------------------------------------------------------------------------*/
int WEST4100_Write(pWEST4100 *pData, int parAddress, int parValue)
{
unsigned char displaytext[20];
unsigned char displaytext[40];
int iRet;
pWEST4100 self;

View File

@ -5445,8 +5445,7 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData,
}
return 1;
} else if(self->abs_encoder && strcasecmp("stats", argv[1]) == 0) {
char line[132];
snprintf(line, CMDLEN, "%s.stats=%s samples=%.0f, slope=%f, intercept=%f, r=%f, stepsPerX=%f",
SCPrintf(pCon, eValue, "%s.stats=%s samples=%.0f, slope=%f, intercept=%f, r=%f, stepsPerX=%f",
self->name,
self->doStats ? "ON" : "OFF",
self->S_n,
@ -5454,7 +5453,6 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData,
self->S_b,
self->S_r,
self->cntsPerX * self->S_m);
SCWrite(pCon, line, eValue);
if (argc > 2) {
if (strcasecmp(argv[2], "reset") == 0) {
/* reset the stats */