- 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

View File

@@ -435,30 +435,30 @@ static int ECBGetError(struct __COUNTER *self, int *iCode,
*iCode = self->iErrorCode;
switch (self->iErrorCode) {
case COMMERROR:
strncpy(errorText, "Communication error with ECB", errlen);
strlcpy(errorText, "Communication error with ECB", errlen);
break;
case TOMANYCOUNTS:
strncpy(errorText, "Preset is to high!", errlen);
strlcpy(errorText, "Preset is to high!", errlen);
break;
case NOSEND:
strncpy(errorText, "Cannot send naked data to ECB", errlen);
strlcpy(errorText, "Cannot send naked data to ECB", errlen);
break;
case UNKNOWNPAR:
strncpy(errorText, "parameter unknown", errlen);
strlcpy(errorText, "parameter unknown", errlen);
break;
case INVALIDCOUNTER:
strncpy(errorText, "Invalid counter number requested, 0-7 allowed",
strlcpy(errorText, "Invalid counter number requested, 0-7 allowed",
errlen);
break;
case INVALIDPRESCALER:
strncpy(errorText, "Invalid prescaler value, allowed 1 or 10", errlen);
strlcpy(errorText, "Invalid prescaler value, allowed 1 or 10", errlen);
break;
case BADFREQ:
strncpy(errorText, "Bad timer frequency: 10 or 1000 allowed", errlen);
strlcpy(errorText, "Bad timer frequency: 10 or 1000 allowed", errlen);
break;
default:
sprintf(pBueffel, "Unknown error code %d", self->iErrorCode);
strncpy(errorText, pBueffel, errlen);
strlcpy(errorText, pBueffel, errlen);
break;
}
return 1;
@@ -580,7 +580,7 @@ static int ECBGet(struct __COUNTER *self, char *name,
static int ECBSend(struct __COUNTER *self, char *text,
char *reply, int replylen)
{
strncpy(reply, "ECB does not feast on ASCII strings, refused!",
strlcpy(reply, "ECB does not feast on ASCII strings, refused!",
replylen);
return OKOK;
}