openbsd-ports/www/webalizer/patches/patch-dns_resolv_c
mbalmer 6ba8133cdd Switch to webalizer xtended by Patrick Frei, which adds IPv6 support and
detailed http 404 error reports.  Webalizer author hinted me at this,
he does not intend to update. danh@ is ok with the maintainer change.

ok stehn, okan.
2008-01-30 20:06:48 +00:00

33 lines
1.5 KiB
Plaintext

$OpenBSD: patch-dns_resolv_c,v 1.4 2008/01/30 20:06:48 mbalmer Exp $
--- dns_resolv.c.orig Mon Aug 6 18:29:25 2007
+++ dns_resolv.c Wed Jan 30 13:24:39 2008
@@ -158,7 +158,7 @@ void resolve_dns(struct log_struct *log_rec)
case 0:
{
memcpy(&alignedRecord, response.data, sizeof(struct dnsRecord));
- strncpy (log_rec->hostname,
+ strlcpy (log_rec->hostname,
((struct dnsRecord *)response.data)->hostName,
MAXHOST);
log_rec->hostname[MAXHOST-1]=0;
@@ -269,7 +269,7 @@ int dns_resolver(void *log_fp)
}
memset(tmp_buf, 0, sizeof(tmp_buf));
- strncpy(tmp_buf, buffer, sizeof(tmp_buf)-1); /* save buffer in case of error */
+ strlcpy(tmp_buf, buffer, sizeof(tmp_buf)); /* save buffer in case of error */
if(parse_record(buffer)) /* parse the record */
{
struct addrinfo hints, *ares;
@@ -460,8 +460,8 @@ static void process_list(DNODEPTR l_list)
/* If long hostname, take max domain name part */
if ((size = strlen(hbuf)) > MAXHOST-2)
- strcpy(child_buf,(hbuf+(size-MAXHOST+1)));
- else strcpy(child_buf, hbuf);
+ strlcpy(child_buf,(hbuf+(size-MAXHOST+1)),sizeof(child_buf));
+ else strlcpy(child_buf, hbuf,sizeof(child_buf));
size = strlen(child_buf);
}
else