From owner-svn-src-all@FreeBSD.ORG Sun Apr 10 15:21:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07E3C106564A; Sun, 10 Apr 2011 15:21:47 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E96748FC13; Sun, 10 Apr 2011 15:21:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3AFLkPF052103; Sun, 10 Apr 2011 15:21:46 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3AFLkX6052101; Sun, 10 Apr 2011 15:21:46 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201104101521.p3AFLkX6052101@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 10 Apr 2011 15:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220522 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 15:21:47 -0000 Author: trociny Date: Sun Apr 10 15:21:46 2011 New Revision: 220522 URL: http://svn.freebsd.org/changeset/base/220522 Log: In hast_proto_recv_data() check that the size of the data to be received does not exceed the buffer size. Approved by: pjd (mentor) MFC after: 1 week Modified: head/sbin/hastd/hast_proto.c Modified: head/sbin/hastd/hast_proto.c ============================================================================== --- head/sbin/hastd/hast_proto.c Sun Apr 10 15:11:19 2011 (r220521) +++ head/sbin/hastd/hast_proto.c Sun Apr 10 15:21:46 2011 (r220522) @@ -189,9 +189,12 @@ hast_proto_recv_data(const struct hast_r dptr = data; dsize = nv_get_uint32(nv, "size"); - if (dsize == 0) + if (dsize > size) { + errno = EINVAL; + goto end; + } else if (dsize == 0) { (void)nv_set_error(nv, 0); - else { + } else { if (proto_recv(conn, data, dsize) < 0) goto end; for (ii = sizeof(pipeline) / sizeof(pipeline[0]); ii > 0;