NetBSD Problem Report #45217

From www@NetBSD.org  Fri Aug  5 21:31:03 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B66F863CBEE
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  5 Aug 2011 21:31:03 +0000 (UTC)
Message-Id: <20110805213103.0185563CB59@www.NetBSD.org>
Date: Fri,  5 Aug 2011 21:31:02 +0000 (UTC)
From: mm@FreeBSD.org
Reply-To: mm@FreeBSD.org
To: gnats-bugs@NetBSD.org
Subject: makefs violates ECMA-119 (ISO9660) specification
X-Send-Pr-Version: www-1.0

>Number:         45217
>Category:       bin
>Synopsis:       makefs violates ECMA-119 (ISO9660) specification
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 05 21:35:00 +0000 2011
>Closed-Date:    Sun Aug 07 08:49:13 +0000 2011
>Last-Modified:  Sun Aug 07 08:49:13 +0000 2011
>Originator:     Martin Matuska
>Release:        
>Organization:
>Environment:
>Description:
src/usr.sbin/makefs/cd9660.c:
In cd9660_set_defaults() the following structures are wrongly initialized:

volume_set_id has 128 bytes, only 32 are filled with 0x20
copyright_file_id has 37 bytes, 128 bytes are filled with 0x20
abstract_file_id has 37 bytes, 128 bytes are filled with 0x20
bibliographic_file_if has 37 bytes, 128 bytes are filled with 0x20

similiar in cd9660_finalize_PVD()

This causes, among other unwanted things, that the unused4 byte is written with 0x20. The specification requires a zero.

See attached patch.
>How-To-Repeat:

>Fix:
Index: src/usr.sbin/makefs/cd9660.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makefs/cd9660.c,v
retrieving revision 1.30
diff -p -u -r1.30 cd9660.c
--- src/usr.sbin/makefs/cd9660.c	29 May 2011 17:07:57 -0000	1.30
+++ src/usr.sbin/makefs/cd9660.c	5 Aug 2011 21:29:41 -0000
@@ -231,13 +231,13 @@ cd9660_set_defaults(void)
 	/* Make sure the PVD is clear */
 	memset(&diskStructure.primaryDescriptor, 0, 2048);

-	memset(diskStructure.primaryDescriptor.volume_set_id,	0x20,32);
+	memset(diskStructure.primaryDescriptor.volume_set_id,	0x20,128);
 	memset(diskStructure.primaryDescriptor.publisher_id,	0x20,128);
 	memset(diskStructure.primaryDescriptor.preparer_id,	0x20,128);
 	memset(diskStructure.primaryDescriptor.application_id,	0x20,128);
-	memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,128);
-	memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,128);
-	memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,128);
+	memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,37);
+	memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,37);
+	memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,37);

 	strcpy(diskStructure.primaryDescriptor.system_id,"NetBSD");

@@ -677,11 +677,11 @@ cd9660_finalize_PVD(void)
 	cd9660_pad_string_spaces(diskStructure.primaryDescriptor.application_id,
 	    128);
 	cd9660_pad_string_spaces(
-	    diskStructure.primaryDescriptor.copyright_file_id, 128);
+	    diskStructure.primaryDescriptor.copyright_file_id, 37);
 	cd9660_pad_string_spaces(
-		diskStructure.primaryDescriptor.abstract_file_id, 128);
+		diskStructure.primaryDescriptor.abstract_file_id, 37);
 	cd9660_pad_string_spaces(
-		diskStructure.primaryDescriptor.bibliographic_file_id, 128);
+		diskStructure.primaryDescriptor.bibliographic_file_id, 37);

 	/* Setup dates */
 	time(&tim);

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45217 CVS commit: src/usr.sbin/makefs
Date: Sat, 6 Aug 2011 19:25:19 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sat Aug  6 23:25:19 UTC 2011

 Modified Files:
 	src/usr.sbin/makefs: cd9660.c

 Log Message:
 PR/45217: Martin Matuska: Use proper lengths to space pad fields and don't
 overwrite them according to the spec.


 To generate a diff of this commit:
 cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/makefs/cd9660.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 07 Aug 2011 08:49:13 +0000
State-Changed-Why:
Committed by christos. Thanks for the patch!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.