diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2010-12-12 22:29:40 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2010-12-12 22:29:40 +0000 |
commit | ed78c3ded99068c67bcc3b940b1dd580d54dcab6 (patch) | |
tree | 64bca67a499247ae617e7e274aac75a0ef317a20 /usr.sbin | |
parent | ee7753ef6e9ba5d91170cb22443d9f31907a7555 (diff) |
use memcpy instead of a cast/deref dance that was reading past
the end of the buffer.
tested by and ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/dns.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index fd3da9b0c29..7c9ca8d5cce 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.26 2010/11/29 15:25:55 gilles Exp $ */ +/* $OpenBSD: dns.c,v 1.27 2010/12/12 22:29:39 jsg Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -236,7 +236,7 @@ dns_asr_handler(int fd, short event, void *arg) if (ret == ASR_YIELD) { free(ar.ar_cname); query->error = 0; - query->ss = *(struct sockaddr_storage *)&ar.ar_sa.sa; + memcpy(&query->ss, &ar.ar_sa.sa, sizeof(ar.ar_sa.sa)); imsg_compose_event(query->asker, IMSG_DNS_HOST, 0, 0, -1, query, sizeof(*query)); dns_asr_handler(-1, -1, dnssession); @@ -373,7 +373,7 @@ dns_asr_mx_handler(int fd, short event, void *arg) if (ret == ASR_YIELD) { free(ar.ar_cname); - query->ss = *(struct sockaddr_storage *)&ar.ar_sa.sa; + memcpy(&query->ss, &ar.ar_sa.sa, sizeof(ar.ar_sa.sa)); query->error = 0; imsg_compose_event(query->asker, IMSG_DNS_HOST, 0, 0, -1, query, sizeof(*query)); |