Module Name: src Committed By: snj Date: Sat Jan 2 06:27:27 UTC 2010
Modified Files: src/usr.sbin/makefs/cd9660 [netbsd-5-0]: iso9660_rrip.c Log Message: Pull up following revision(s) (requested by tsutsui in ticket #1198): usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.6 Fix another bug in SUSP "CE" handling: when the SUSP records fit into the System Use field with fewer then 28 bytes to spare, we were remembering the wrong length for the System Use field and hence emitting a corrupt directory entry. This could be triggered by trying to build a filesystem containing a regular file with a 120-byte name. Now we're a little more careful. To generate a diff of this commit: cvs rdiff -u -r1.4.20.1 -r1.4.20.2 src/usr.sbin/makefs/cd9660/iso9660_rrip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.c diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.1 src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.2 --- src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.1 Sat Jan 2 06:26:11 2010 +++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c Sat Jan 2 06:27:27 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: iso9660_rrip.c,v 1.4.20.1 2010/01/02 06:26:11 snj Exp $ */ +/* $NetBSD: iso9660_rrip.c,v 1.4.20.2 2010/01/02 06:27:27 snj Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -43,7 +43,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: iso9660_rrip.c,v 1.4.20.1 2010/01/02 06:26:11 snj Exp $"); +__RCSID("$NetBSD: iso9660_rrip.c,v 1.4.20.2 2010/01/02 06:27:27 snj Exp $"); #endif /* !__lint */ static void cd9660_rrip_initialize_inode(cd9660node *); @@ -200,7 +200,7 @@ static int cd9660_susp_handle_continuation_common(cd9660node *node, int space) { - int ca_used, susp_used, working; + int ca_used, susp_used, susp_used_last, working; struct ISO_SUSP_ATTRIBUTES *temp, *last = NULL, *CE; working = 254 - space; @@ -216,9 +216,15 @@ * CD9660_SUSP_ENTRY_SIZE(temp)); */ working -= CD9660_SUSP_ENTRY_SIZE(temp); + if (working >= 0) + susp_used += CD9660_SUSP_ENTRY_SIZE(temp); if (working >= 28) { + /* + * Remember the last entry after which we + * could insert a "CE" entry. + */ last = temp; - susp_used += CD9660_SUSP_ENTRY_SIZE(temp); + susp_used_last = susp_used; } } @@ -229,7 +235,7 @@ cd9660_susp_ce(CE, node); /* This will automatically insert at the appropriate location */ TAILQ_INSERT_AFTER(&node->head, last, CE, rr_ll); - susp_used += 28; + susp_used = susp_used_last + 28; /* Count how much CA data is necessary */ for (temp = TAILQ_NEXT(CE, rr_ll); temp != NULL;