]> git.wh0rd.org - dump.git/commitdiff
Fixed labels exactly 16 bytes in length.
authorStelian Pop <stelian@popies.net>
Tue, 25 Feb 2003 14:06:47 +0000 (14:06 +0000)
committerStelian Pop <stelian@popies.net>
Tue, 25 Feb 2003 14:06:47 +0000 (14:06 +0000)
CHANGES
compat/lib/bylabel.c

diff --git a/CHANGES b/CHANGES
index b8593de11b2678360a3151d9eee60eec4a13a222..d31eb69245afdb9a528459a02d2ee2943f036fc9 100644 (file)
--- 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
        <fabrice@bellet.info> for reporting the bug.
 
+7.     Fixed a bug preventing dump to access a filesystem having 
+       a label exactly 16 bytes in length. Thanks to <minduni@ti-edu.ch>
+       for reporting the bug.
+
 Changes between versions 0.4b32 and 0.4b33 (released February 10, 2003)
 =======================================================================
 
index 07f0dd92320ccb112b773a9eb54e44b1a826256c..7f710ed7655e7196cef4a528cb5c92a242dc48e9 100644 (file)
 #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;
 }