Skip to content

Commit d03c5a9

Browse files
authored
Examples: Ensure null termination for symbolic link buffer
fixes #123
1 parent 4c9975a commit d03c5a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public int readlink(String path, ByteBuffer buf, long len) {
172172
try {
173173
var target = Files.readSymbolicLink(node);
174174
var tmp = StandardCharsets.UTF_8.encode(target.toString());
175-
buf.put(tmp);
175+
buf.put(tmp).put((byte) 0); //java strings are not null-terminated, hence add nullbyte at end to follow api doc
176176
return 0;
177177
} catch (BufferOverflowException e) {
178178
return -errno.enomem();

0 commit comments

Comments
 (0)