Page MenuHomeFreeBSD

D48193.diff
No OneTemporary

D48193.diff

diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h
--- a/usr.sbin/makefs/cd9660.h
+++ b/usr.sbin/makefs/cd9660.h
@@ -72,8 +72,7 @@
/*30 for name and extension, as well as version number and padding bit*/
#define ISO_FILENAME_MAXLENGTH_BEFORE_VERSION 30
-#define ISO_FILENAME_MAXLENGTH 36
-#define ISO_FILENAME_MAXLENGTH_WITH_PADDING 37
+#define ISO_FILENAME_MAXLENGTH 38
#define ISO_FLAG_CLEAR 0x00
#define ISO_FLAG_HIDDEN 0x01
@@ -118,7 +117,7 @@
u_char interleave [ISODCL (28, 28)]; /* 711 */
u_char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
u_char name_len [ISODCL (33, 33)]; /* 711 */
- char name [ISO_FILENAME_MAXLENGTH_WITH_PADDING];
+ char name [ISO_FILENAME_MAXLENGTH];
} iso_directory_record_cd9660;
/* TODO: Lots of optimization of this structure */
@@ -154,7 +153,7 @@
int fileRecordSize;/*copy of a variable, int for quicker calculations*/
/* Old name, used for renaming - needs to be optimized but low priority */
- char o_name [ISO_FILENAME_MAXLENGTH_WITH_PADDING];
+ char o_name [ISO_FILENAME_MAXLENGTH];
/***** SPACE RESERVED FOR EXTENSIONS *****/
/* For memory efficiency's sake - we should move this to a separate struct
@@ -194,7 +193,7 @@
u_char extended_attribute_length[ISODCL (2, 2)];
u_char first_sector[ISODCL (3, 6)];
u_char parent_number[ISODCL (7, 8)];
- char name[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
+ char name[ISO_FILENAME_MAXLENGTH];
} path_table_entry;
typedef struct _volume_descriptor
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -497,7 +497,7 @@
real_root->isoDirRecord = emalloc(sizeof(*real_root->isoDirRecord));
/* Leave filename blank for root */
memset(real_root->isoDirRecord->name, 0,
- ISO_FILENAME_MAXLENGTH_WITH_PADDING);
+ sizeof(real_root->isoDirRecord->name));
real_root->level = 0;
diskStructure->rootNode = real_root;
@@ -796,10 +796,10 @@
cd9660_translate_node_common(iso9660_disk *diskStructure, cd9660node *newnode)
{
u_char flag;
- char temp[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
+ char temp[ISO_FILENAME_MAXLENGTH];
/* Now populate the isoDirRecord structure */
- memset(temp, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING);
+ memset(temp, 0, sizeof(temp));
(void)cd9660_convert_filename(diskStructure, newnode->node->name,
temp, sizeof(temp), !(S_ISDIR(newnode->node->type)));
@@ -1044,7 +1044,7 @@
else
maxlength = ISO_FILENAME_MAXLENGTH_BEFORE_VERSION;
- tmp = emalloc(ISO_FILENAME_MAXLENGTH_WITH_PADDING);
+ tmp = emalloc(ISO_FILENAME_MAXLENGTH);
while (i < num && iter) {
powers = 1;
@@ -1105,8 +1105,7 @@
while (digits > 0) {
digit = (int)(temp / powers);
temp = temp - digit * powers;
- snprintf(&tmp[numbts],
- ISO_FILENAME_MAXLENGTH_WITH_PADDING - numbts,
+ snprintf(&tmp[numbts], ISO_FILENAME_MAXLENGTH - numbts,
"%d", digit);
digits--;
numbts++;
@@ -1153,8 +1152,7 @@
TAILQ_FOREACH(cn, &node->cn_children, cn_next_child) {
cd9660_copy_filenames(diskStructure, cn);
- memcpy(cn->o_name, cn->isoDirRecord->name,
- ISO_FILENAME_MAXLENGTH_WITH_PADDING);
+ memcpy(cn->o_name, cn->isoDirRecord->name, sizeof(cn->o_name));
}
}
@@ -1277,7 +1275,7 @@
/* TODO: Inherit permissions / ownership (basically the entire inode) */
/* Set the new name */
- memset(dir->isoDirRecord->name, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING);
+ memset(dir->isoDirRecord->name, 0, sizeof(dir->isoDirRecord->name));
strncpy(dir->isoDirRecord->name, newname, 8);
dir->isoDirRecord->length[0] = 34 + 8;
dir->isoDirRecord->name_len[0] = 8;

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 25, 3:02 PM (14 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15615944
Default Alt Text
D48193.diff (3 KB)

Event Timeline