break; /* NOTE BREAK OUT */
}
if (pre == NULL) { /* unknown protocol */
- strcpy(unk, "unk");
+ strncpy(unk, "unk", sizeof(unk));
(void) ultot((unsigned char)sa->proto, 10, unk+strlen(unk),
sizeof(unk)-strlen(unk));
pre = unk;
if (strcmp(pre, PASSTHROUGHTYPE) == 0 &&
sa->spi == PASSTHROUGHSPI &&
isunspecaddr(&sa->dst)) {
- strcpy(buf, (addrtypeof(&sa->dst) == AF_INET) ?
+ strncpy(buf, (addrtypeof(&sa->dst) == AF_INET) ?
PASSTHROUGH4NAME :
- PASSTHROUGH6NAME);
+ PASSTHROUGH6NAME, sizeof(buf));
len = strlen(buf);
}
default: p = NULL; break;
}
if (p != NULL) {
- strcpy(buf, p);
+ strncpy(buf, p, sizeof(buf));
len = strlen(buf);
}
}
if (len == 0) { /* general case needed */
- strcpy(buf, pre);
+ strncpy(buf, pre, sizeof(buf));
len = strlen(buf);
if (showversion) {
*(buf+len) = (addrtypeof(&sa->dst) == AF_INET) ? '.' :
if (dst != NULL) {
if (len > dstlen)
*(buf+dstlen-1) = '\0';
- strcpy(dst, buf);
+ strncpy(dst, buf, dstlen);
}
return len;
}
}
else if (subnetisnone(&this->client))
{
- strcpy(client, "?");
+ strncpy(client, "?", sizeof(client));
}
else
{
/* we are mode config client, or a server with a pool */
client_sep = "===";
client[0] = '%';
- strcpy(client+1, this->pool ? this->pool : "modecfg");
+ strncpy(client+1, this->pool ?: "modecfg", sizeof(client)-1);
}
/* host */