cryptomator / cryptofs

Java Filesystem Provider with integrated encryption
GNU Affero General Public License v3.0
93 stars 35 forks source link

Long filesnames are persisted with NULL Bytes at the end #121

Closed infeo closed 2 years ago

infeo commented 2 years ago

In CryptoFS, the name of a resource (file, dir, symlink) is shortend and the name is stored in an additional file (name.c9s), if the name exceeds a certain length. In version 2.3.0. This mechanism is broken in cryptofs 2.3.0.

When a file with a long name (aka it needs to be shortend) is created, in name.c9s NULL-Bytes might be appended at the end of the encrypted long name.

The reason for this behaviour is f8079199c313942cf83efe134c16aca629a9336a. ByteBuffer.array() returns the whole array of the byte buffer, not just the "non-empty" part of it.

infeo commented 2 years ago

This should also be backported to the 1.9.x branch.

Nevermind, 1.9.x is not affected.

infeo commented 2 years ago

Additionally, for applications affected by this bug, we should offer a health check/result/fix for this.