From: tedu Date: Thu, 15 Oct 2015 21:56:52 +0000 (+0000) Subject: doh, not all requests are the same size. check len first. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=92a74c588662ad42df3d1efa26b1ce0a62d87381;p=openbsd doh, not all requests are the same size. check len first. --- diff --git a/usr.sbin/rebound/rebound.c b/usr.sbin/rebound/rebound.c index f5ba84717a5..724fc60303d 100644 --- a/usr.sbin/rebound/rebound.c +++ b/usr.sbin/rebound/rebound.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rebound.c,v 1.9 2015/10/15 21:39:15 tedu Exp $ */ +/* $OpenBSD: rebound.c,v 1.10 2015/10/15 21:56:52 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -123,7 +123,8 @@ cachelookup(struct dnspacket *dnsreq, size_t reqlen) origid = dnsreq->id; dnsreq->id = 0; TAILQ_FOREACH(hit, &cache, cache) { - if (memcmp(hit->req, dnsreq, reqlen) == 0) + if (hit->reqlen == reqlen && + memcmp(hit->req, dnsreq, reqlen) == 0) break; } dnsreq->id = origid;