]> wimlib.net Git - wimlib/blobdiff - src/dentry.c
utf16le_dupz() input may be misaligned
[wimlib] / src / dentry.c
index fb268039590d3d75babba42206e78103b86425f5..862c6640c9bb54b9bef52610824604091b830e13 100644 (file)
@@ -5,19 +5,18 @@
 /*
  * Copyright (C) 2012, 2013, 2014 Eric Biggers
  *
 /*
  * Copyright (C) 2012, 2013, 2014 Eric Biggers
  *
- * This file is part of wimlib, a library for working with WIM files.
- *
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 3 of the License, or (at your option) any later
- * version.
- *
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * wimlib; if not, see http://www.gnu.org/licenses/.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
  */
 
 /*
  */
 
 /*
@@ -65,6 +64,7 @@
 #include "wimlib/encoding.h"
 #include "wimlib/endianness.h"
 #include "wimlib/metadata.h"
 #include "wimlib/encoding.h"
 #include "wimlib/endianness.h"
 #include "wimlib/metadata.h"
+#include "wimlib/paths.h"
 
 #include <errno.h>
 
 
 #include <errno.h>
 
@@ -912,8 +912,6 @@ new_dentry(const tchar *name, struct wim_dentry **dentry_ret)
                ret = dentry_set_name(dentry, name);
                if (ret) {
                        FREE(dentry);
                ret = dentry_set_name(dentry, name);
                if (ret) {
                        FREE(dentry);
-                       ERROR("Failed to set name on new dentry with name \"%"TS"\"",
-                             name);
                        return ret;
                }
        }
                        return ret;
                }
        }
@@ -1344,8 +1342,7 @@ read_dentry(const u8 * restrict buf, size_t buf_len,
        /* Read the filename if present.  Note: if the filename is empty, there
         * is no null terminator following it.  */
        if (file_name_nbytes) {
        /* Read the filename if present.  Note: if the filename is empty, there
         * is no null terminator following it.  */
        if (file_name_nbytes) {
-               dentry->file_name = utf16le_dupz((const utf16lechar *)p,
-                                                file_name_nbytes);
+               dentry->file_name = utf16le_dupz(p, file_name_nbytes);
                if (dentry->file_name == NULL) {
                        ret = WIMLIB_ERR_NOMEM;
                        goto err_free_dentry;
                if (dentry->file_name == NULL) {
                        ret = WIMLIB_ERR_NOMEM;
                        goto err_free_dentry;
@@ -1357,8 +1354,7 @@ read_dentry(const u8 * restrict buf, size_t buf_len,
        /* Read the short filename if present.  Note: if there is no short
         * filename, there is no null terminator following it. */
        if (short_name_nbytes) {
        /* Read the short filename if present.  Note: if there is no short
         * filename, there is no null terminator following it. */
        if (short_name_nbytes) {
-               dentry->short_name = utf16le_dupz((const utf16lechar *)p,
-                                                 short_name_nbytes);
+               dentry->short_name = utf16le_dupz(p, short_name_nbytes);
                if (dentry->short_name == NULL) {
                        ret = WIMLIB_ERR_NOMEM;
                        goto err_free_dentry;
                if (dentry->short_name == NULL) {
                        ret = WIMLIB_ERR_NOMEM;
                        goto err_free_dentry;