Avoid passing NULL as memcpy source (undefined behavior)
[wimlib] / src / win32_apply.c
index c31d266841700f029a674dc1ea4b06577ebca503..cb488a9f6ed656013b74b67cacbf74b6c63914af 100644 (file)
@@ -901,7 +901,9 @@ build_extraction_path(const struct wim_dentry *dentry,
             d = d->d_parent)
        {
                p -= d->d_extraction_name_nchars;
-               wmemcpy(p, d->d_extraction_name, d->d_extraction_name_nchars);
+               if (d->d_extraction_name_nchars)
+                       wmemcpy(p, d->d_extraction_name,
+                               d->d_extraction_name_nchars);
                *--p = '\\';
        }
        /* No leading slash  */