From owner-svn-src-all@FreeBSD.ORG Mon Sep 28 07:43:00 2009 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 15DDE10656D8; Mon, 28 Sep 2009 07:42:59 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB32B8FC14; Mon, 28 Sep 2009 07:42:59 +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 n8S7gxWH047063; Mon, 28 Sep 2009 07:42:59 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8S7gxKV047061; Mon, 28 Sep 2009 07:42:59 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200909280742.n8S7gxKV047061@svn.freebsd.org> From: Andrew Thompson Date: Mon, 28 Sep 2009 07:42:59 +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: r197561 - head/sys/dev/usb 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: Mon, 28 Sep 2009 07:43:00 -0000 Author: thompsa Date: Mon Sep 28 07:42:59 2009 New Revision: 197561 URL: http://svn.freebsd.org/changeset/base/197561 Log: Correct buffer sizes used so that they match. The old code could give the impression that a overflow situation existed but was not possible. Reported by: kib Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon Sep 28 07:42:52 2009 (r197560) +++ head/sys/dev/usb/usb_device.c Mon Sep 28 07:42:59 2009 (r197561) @@ -2355,6 +2355,7 @@ usb_notify_addq(const char *type, struct { char *data = NULL; struct malloc_type *mt; + const size_t buf_size = 512; mtx_lock(&malloc_mtx); mt = malloc_desc2type("bus"); /* XXX M_BUS */ @@ -2362,12 +2363,12 @@ usb_notify_addq(const char *type, struct if (mt == NULL) return; - data = malloc(512, mt, M_NOWAIT); + data = malloc(buf_size, mt, M_NOWAIT); if (data == NULL) return; /* String it all together. */ - snprintf(data, 1024, + snprintf(data, buf_size, "%s" "%s " "vendor=0x%04x "