if (tcpClient != NULL)
tcpClient->remote.NtoA(buf, bufsz);
else if (cache.caddr.IsNoAddr()) // e.g., ICAP OPTIONS lack client
- strncpy(buf, "-", 1);
+ strncpy(buf, "-", bufsz);
else
cache.caddr.NtoA(buf, bufsz);
}
}
assert(npc < npc_alloc);
- strcpy(searchpath[npc].domain, buf);
+ strncpy(searchpath[npc].domain, buf, sizeof(searchpath[npc].domain)-1);
+ searchpath[npc].domain[sizeof(searchpath[npc].domain)-1] = '\0';
Tolower(searchpath[npc].domain);
debugs(78, 3, "idnsAddPathComponent: Added domain #" << npc << ": " << searchpath[npc].domain);
++npc;
{
#if USE_CACHE_DIGESTS
if (p)
- strncpy(request->hier.cd_host, p->host, sizeof(request->hier.cd_host));
+ strncpy(request->hier.cd_host, p->host, sizeof(request->hier.cd_host)-1);
else
*request->hier.cd_host = '\0';
/* For IPV6 addresses also check for a colon */
if (Config.appendDomain && !strchr(lt, '.') && !strchr(lt, ':')) {
/* I know it's ugly, but it's only at reconfig */
- strncpy(buf2, lt, 512);
- strncat(buf2, Config.appendDomain, 512 - strlen(lt) - 1);
+ strncpy(buf2, lt, sizeof(buf2)-1);
+ strncat(buf2, Config.appendDomain, sizeof(buf2) - strlen(lt) - 1);
+ buf1[sizeof(buf2)-1] = '\0';
host = buf2;
} else {
host = lt;
/* Is there any login information? (we should eventually parse it above) */
t = strrchr(host, '@');
if (t != NULL) {
- strcpy((char *) login, (char *) host);
+ strncpy((char *) login, (char *) host, sizeof(login)-1);
+ login[sizeof(login)-1] = '\0';
t = strrchr(login, '@');
*t = 0;
- strcpy((char *) host, t + 1);
+ strncpy((char *) host, t + 1, sizeof(host)-1);
+ host[sizeof(host)-1] = '\0';
}
/* Is there any host information? (we should eventually parse it above) */
SquidMD5Init(&M);
- SquidMD5Update(&M, pwd, 8);
+ SquidMD5Update(&M, pwd, sizeof(pwd));
SquidMD5Update(&M, packet, len);
/* The password field, for the MD5 hash, needs to be 8 bytes and NUL padded. */
memset(pwd, 0, sizeof(pwd));
-
strncpy(pwd, srv->wccp_password, sizeof(pwd));
/* Take a copy of the challenge: we need to NUL it before comparing */
SquidMD5Init(&M);
- SquidMD5Update(&M, pwd, 8);
+ SquidMD5Update(&M, pwd, sizeof(pwd));
SquidMD5Update(&M, packet, len);