From owner-freebsd-bugs Tue Oct 1 22: 0:13 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7516837B401 for ; Tue, 1 Oct 2002 22:00:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 671EE43E4A for ; Tue, 1 Oct 2002 22:00:08 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g92508Co037458 for ; Tue, 1 Oct 2002 22:00:08 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g925086W037457; Tue, 1 Oct 2002 22:00:08 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 177C937B401 for ; Tue, 1 Oct 2002 21:51:32 -0700 (PDT) Received: from tomts15-srv.bellnexxia.net (tomts15.bellnexxia.net [209.226.175.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 519FE43E6A for ; Tue, 1 Oct 2002 21:51:30 -0700 (PDT) (envelope-from matt@gsicomp.on.ca) Received: from xena.gsicomp.on.ca ([65.95.176.54]) by tomts15-srv.bellnexxia.net (InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with ESMTP id <20021002045128.TSAF12486.tomts15-srv.bellnexxia.net@xena.gsicomp.on.ca> for ; Wed, 2 Oct 2002 00:51:28 -0400 Received: from gabby.gsicomp.on.ca (root@gabby.gsicomp.on.ca [192.168.0.2]) by xena.gsicomp.on.ca (8.11.3/8.11.3) with ESMTP id g923VTp09084 for ; Tue, 1 Oct 2002 23:31:29 -0400 (EDT) (envelope-from matt@gabby.gsicomp.on.ca) Received: (from matt@localhost) by gabby.gsicomp.on.ca (8.11.6/8.9.3) id g924Uvw24902; Wed, 2 Oct 2002 00:30:57 -0400 (EDT) (envelope-from matt) Message-Id: <200210020430.g924Uvw24902@gabby.gsicomp.on.ca> Date: Wed, 2 Oct 2002 00:30:57 -0400 (EDT) From: Matthew Emmerton Reply-To: Matthew Emmerton To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/43574: burncd prints incorrect output when using -l option Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 43574 >Category: bin >Synopsis: burncd prints incorrect output when using -l option >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 01 22:00:07 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Matthew Emmerton >Release: FreeBSD 4.4-RELEASE i386 >Organization: GSI Computer Services >Environment: System: FreeBSD gabby.gsicomp.on.ca 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Wed Aug 28 21:49:13 EDT 2002 root@gabby.gsicomp.on.ca:/archive/obj/usr/src/sys/GABBY.20020821.01 i386 Also occurs on -CURRENT from about two weeks ago. >Description: When using burncd with the -l (list) option, as each file is burned, the name of each file is not displayed. Instead, the name of the last file in the list is always displayed. As written, a pointer to the filename is saved in the per-track structure for each track. While this works fine when all files are given on the command line (since each filename is a different element of argv[]), this fails when a listing file is used. This is because when the listing file is parsed, the lines are read into a buffer, and it's the address of this buffer that is saved in the per-track structure. Since each track will then have a file_name pointer pointing to the single static buffer, the filename that will be displayed for each track is the last file in the list (the last contents of the buffer). >How-To-Repeat: $ cat filelist pcm/song1.pcm pcm/song2.pcm pcm/song3.pcm $ burncd -s 24 /dev/acd0c -l audio filelist fixate >Fix: --- usr.sbin/burncd/burncd.c.orig Mon Sep 30 22:51:26 2002 +++ usr.sbin/burncd/burncd.c Mon Sep 30 22:55:13 2002 @@ -48,7 +48,7 @@ struct track_info { int file; - char *file_name; + char file_name[MAXPATHLEN + 1]; off_t file_size; int block_size; int block_type; @@ -331,7 +331,7 @@ if (fstat(file, &sb) < 0) err(EX_IOERR, "fstat(%s)", name); tracks[notracks].file = file; - tracks[notracks].file_name = name; + strncpy(tracks[notracks].file_name, name, MAXPATHLEN); if (file == STDIN_FILENO) tracks[notracks].file_size = -1; else >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message