From 81ffa8b843b1adb19ebe5dfe4bde01457853a3e8 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Thu, 27 Dec 2007 10:50:07 +0000 Subject: Add a missing length check of received spamd sync packet headers. From Diego Giagio (dgiagio at gmail) with input from tedu@ --- libexec/spamd/sync.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libexec') diff --git a/libexec/spamd/sync.c b/libexec/spamd/sync.c index c7ff0c8ba6f..11caa4f3997 100644 --- a/libexec/spamd/sync.c +++ b/libexec/spamd/sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sync.c,v 1.3 2007/04/13 05:55:03 otto Exp $ */ +/* $OpenBSD: sync.c,v 1.4 2007/12/27 10:50:06 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter @@ -273,7 +273,8 @@ sync_recv(void) /* Ignore invalid or truncated packets */ hdr = (struct spam_synchdr *)buf; - if (hdr->sh_version != SPAM_SYNC_VERSION || + if (len < sizeof(struct spam_synchdr) || + hdr->sh_version != SPAM_SYNC_VERSION || hdr->sh_af != AF_INET || len < ntohs(hdr->sh_length)) goto trunc; -- cgit v1.2.3