Avoid passing NULL as memcpy source (undefined behavior)
[wimlib] / src / unix_apply.c
index f1962d9884b63752892217f3eed71b29393a777c..ae9b8cea55e7ea7fde64de03e5cfbcedb703a4fe 100644 (file)
@@ -156,7 +156,9 @@ unix_build_extraction_path(const struct wim_dentry *dentry,
        d = dentry;
        do {
                p -= d->d_extraction_name_nchars;
-               memcpy(p, d->d_extraction_name, d->d_extraction_name_nchars);
+               if (d->d_extraction_name_nchars)
+                       memcpy(p, d->d_extraction_name,
+                              d->d_extraction_name_nchars);
                *--p = '/';
                d = d->d_parent;
        } while (!dentry_is_root(d) && will_extract_dentry(d));