Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2002 00:30:57 -0400 (EDT)
From:      Matthew Emmerton <matt@gsicomp.on.ca>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/43574: burncd prints incorrect output when using -l option
Message-ID:  <200210020430.g924Uvw24902@gabby.gsicomp.on.ca>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210020430.g924Uvw24902>