From: Stelian Pop Date: Tue, 25 Feb 2003 14:06:47 +0000 (+0000) Subject: Fixed labels exactly 16 bytes in length. X-Git-Tag: release_0_4b34~12 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=cdef84caee08a2436de99fc3e6f5d8eeb3635072;p=dump.git Fixed labels exactly 16 bytes in length. --- diff --git a/CHANGES b/CHANGES index b8593de..d31eb69 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.217 2003/02/17 10:31:44 stelian Exp $ +$Id: CHANGES,v 1.218 2003/02/25 14:06:47 stelian Exp $ Changes between versions 0.4b33 and 0.4b34 (released ?????????????????) ======================================================================= @@ -28,6 +28,10 @@ Changes between versions 0.4b33 and 0.4b34 (released ?????????????????) dump is able to write now (-b 1024). Thanks to Fabrice Bellet for reporting the bug. +7. Fixed a bug preventing dump to access a filesystem having + a label exactly 16 bytes in length. Thanks to + for reporting the bug. + Changes between versions 0.4b32 and 0.4b33 (released February 10, 2003) ======================================================================= diff --git a/compat/lib/bylabel.c b/compat/lib/bylabel.c index 07f0dd9..7f710ed 100644 --- a/compat/lib/bylabel.c +++ b/compat/lib/bylabel.c @@ -29,12 +29,14 @@ #define EXT2_SUPER_SIZE sizeof(struct ext2_super_block) #define EXT2_SUPER_MAGIC 0xEF53 +#define VOLNAMSZ 16 + struct ext2_super_block { unsigned char s_dummy1[56]; unsigned char s_magic[2]; unsigned char s_dummy2[46]; unsigned char s_uuid[16]; - unsigned char s_volume_name[16]; + unsigned char s_volume_name[VOLNAMSZ]; }; #define ext2magic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8)) @@ -71,7 +73,9 @@ get_label_uuid(const char *device, char **label, char *uuid) { /* superblock is ext2 - now what is its label? */ memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid)); - *label = strdup(e2sb.s_volume_name); + *label = malloc(VOLNAMSZ + 1); + strncpy(*label, e2sb.s_volume_name, VOLNAMSZ); + (*label)[VOLNAMSZ] = 0; return 0; }