NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/45217: makefs violates ECMA-119 (ISO9660) specification



>Number:         45217
>Category:       bin
>Synopsis:       makefs violates ECMA-119 (ISO9660) specification
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 05 21:35:00 +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);



Home | Main Index | Thread Index | Old Index