erofs-utils: tar: handle empty filenames correctly
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 28 Feb 2025 04:54:26 +0000 (12:54 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 28 Feb 2025 05:35:18 +0000 (13:35 +0800)
commitffa517605bf978cd76a4449143b1aad8b534d901
treeabf002f046950fae13192ba26cf2b6fd7f715451
parent6fa861e282408f8df9ab1654b77b563444b17ea1
erofs-utils: tar: handle empty filenames correctly

Tar entries with empty filenames are unusual but shouldn't
cause a crash.  Handle this by following `tar` behavior:
substitute `.` for the empty filenames.

Reproducible image (base64-encoded gzipped blob):
H4sICL2XwGcAA3Rlc3RfcmVhZF9mb3JtYXRfdGFyX2VtcHR5X2ZpbGVuYW1lLnRhcgBjY
KA9MDAwMDc3VQDShuamBiAaBGA0hGNoaGBgZGJsaAZUaADiGDIomNLBbQylxSWJRUCnlG
Tm4lVXnpGamoNHHtVTClR14ygYBaNgFNAAAAAE6urMAAYAAA==

Fixes: 95d315fd7958 ("erofs-utils: introduce tarerofs")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250228045426.81099-1-hsiangkao@linux.alibaba.com
lib/tar.c