From owner-freebsd-bugs Fri Mar 23 21:10: 6 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D5A7D37B71E for ; Fri, 23 Mar 2001 21:10:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2O5A1d87602; Fri, 23 Mar 2001 21:10:01 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D96B037B71A for ; Fri, 23 Mar 2001 21:00:18 -0800 (PST) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2O50Ir84611; Fri, 23 Mar 2001 21:00:18 -0800 (PST) (envelope-from nobody) Message-Id: <200103240500.f2O50Ir84611@freefall.freebsd.org> Date: Fri, 23 Mar 2001 21:00:18 -0800 (PST) From: miles@turboflux.net To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/26044: vsprintf calls __swsetup, then __smakebuf, it allocates mem and never frees it Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26044 >Category: misc >Synopsis: vsprintf calls __swsetup, then __smakebuf, it allocates mem and never frees it >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 23 21:10:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Miles Peterson >Release: 4.2-STABLE >Organization: >Environment: FreeBSD Phased.turboflux.net 4.2-STABLE FreeBSD 4.2-STABLE #2: Wed Dec 27 11:49:05 MST 2000 root@Phased.turboflux.net:/usr/src/sys/compile/BRIDGE i386 >Description: vsnprintf() has "FILE f" and sets "f._bf._base = str;" (where str is what the user passes in). If user passes in NULL, __swsetup(&f) calls __smakebuf(&f), which allocates a buffer that isnt ever freed. /usr/src/lib/libc/stdio/vsnprintf.c >How-To-Repeat: vsnprintf(NULL, 0, "yadda yadda!\n"); /* should do it */ >Fix: if (!str) free(p._bf._base); /* just before the return (ret) */ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message