]> wimlib.net Git - wimlib/commitdiff
make_symlink_reparse_data_buf(): Don't include null terminator
authorEric Biggers <ebiggers3@gmail.com>
Sun, 18 Nov 2012 22:25:12 +0000 (16:25 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 18 Nov 2012 22:25:12 +0000 (16:25 -0600)
src/ntfs-capture.c
src/symlink.c

index b47f437e19e392bd8e21ac9b206dfb9b868d5136..cc31377b3b42f727209f6e03c0c284f164f000f6 100644 (file)
@@ -242,8 +242,8 @@ static int ntfs_attr_sha1sum(ntfs_inode *ni, ATTR_RECORD *ar,
        return 0;
 }
 
        return 0;
 }
 
-/* Load the streams from a WIM file or reparse point in the NTFS volume into the
- * WIM lookup table */
+/* Load the streams from a file or reparse point in the NTFS volume into the WIM
+ * lookup table */
 static int capture_ntfs_streams(struct dentry *dentry, ntfs_inode *ni,
                                char path[], size_t path_len,
                                struct lookup_table *lookup_table,
 static int capture_ntfs_streams(struct dentry *dentry, ntfs_inode *ni,
                                char path[], size_t path_len,
                                struct lookup_table *lookup_table,
index b1c5b5d388b4703cf96c6b26d2af7d8dbdb00dbb..6ef0dab16490787a6591f645399c52363b95e53a 100644 (file)
@@ -131,27 +131,23 @@ void *make_symlink_reparse_data_buf(const char *symlink_target, size_t *len_ret)
        char *name_utf16 = utf8_to_utf16(symlink_target, utf8_len, &utf16_len);
        if (!name_utf16)
                return NULL;
        char *name_utf16 = utf8_to_utf16(symlink_target, utf8_len, &utf16_len);
        if (!name_utf16)
                return NULL;
-       /*DEBUG("utf16_len = %zu", utf16_len);*/
+
        for (size_t i = 0; i < utf16_len / 2; i++)
                if (((u16*)name_utf16)[i] == cpu_to_le16('/'))
                        ((u16*)name_utf16)[i] = cpu_to_le16('\\');
        for (size_t i = 0; i < utf16_len / 2; i++)
                if (((u16*)name_utf16)[i] == cpu_to_le16('/'))
                        ((u16*)name_utf16)[i] = cpu_to_le16('\\');
-       size_t len = 12 + utf16_len * 2 + 4;
+       size_t len = 12 + utf16_len * 2;
        void *buf = MALLOC(len);
        if (!buf)
                goto out;
        void *buf = MALLOC(len);
        if (!buf)
                goto out;
-       /* XXX Fix absolute paths */
 
        u8 *p = buf;
 
        u8 *p = buf;
-       p = put_u16(p, utf16_len + 2); /* Substitute name offset */
+       p = put_u16(p, utf16_len); /* Substitute name offset */
        p = put_u16(p, utf16_len); /* Substitute name length */
        p = put_u16(p, 0); /* Print name offset */
        p = put_u16(p, utf16_len); /* Print name length */
        p = put_u16(p, utf16_len); /* Substitute name length */
        p = put_u16(p, 0); /* Print name offset */
        p = put_u16(p, utf16_len); /* Print name length */
-       p = put_u32(p, 1);
+       p = put_u32(p, 1); /* flags: 0 iff *full* target, including drive letter??? */
        p = put_bytes(p, utf16_len, (const u8*)name_utf16);
        p = put_bytes(p, utf16_len, (const u8*)name_utf16);
-       p = put_u16(p, 0);
        p = put_bytes(p, utf16_len, (const u8*)name_utf16);
        p = put_bytes(p, utf16_len, (const u8*)name_utf16);
-       p = put_u16(p, 0);
-       /*DEBUG("utf16_len = %zu, len = %zu", utf16_len, len);*/
        *len_ret = len;
 out:
        FREE(name_utf16);
        *len_ret = len;
 out:
        FREE(name_utf16);