From 92a74c588662ad42df3d1efa26b1ce0a62d87381 Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 15 Oct 2015 21:56:52 +0000 Subject: [PATCH] doh, not all requests are the same size. check len first. --- usr.sbin/rebound/rebound.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; -- 2.20.1