AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
194 stars 30 forks source link

gensquashfs fails to handle file name containing backslash #77

Closed McTrk closed 3 years ago

McTrk commented 3 years ago

Reproduce as follows: gensquashfs -q -o -D /usr/lib/systemd/system/ /tmp/test.squashfs Verify that the problematic file exists: ls -l /usr/lib/systemd/system/system-systemd\\x2dcryptsetup.slice

Verify problematic character: echo $'\x2d'

Screenshot: Screenshot from 2020-12-27 18-36-17

AgentD commented 3 years ago

Hi @McTrk,

thanks for reporting this! The problem is caused by the canonicalization of path names, which normalized backslashes to regular, forward slashes in input path names. Also when unpacking SquashFS images, filenames are sanity checked and rejected if they contain slashes or other OS specific problematic names.

I added a fix in commit 0e3bb2104a8e3fd07e201e6ba99f8d017fdc72a8 which removes the normalization and modifies the unpacking sanity check to only reject backslashes on Windows.

With the fix applied, your example case appears to work on my end now at least.