casaroli opened a new pull request, #20592: URL: https://github.com/apache/nuttx/pull/20592
## Summary `readlink()` of a path in a mounted file system returned `strlen()` of the buffer. The `readlink` method of a file system, like `readlink()` itself, returns the number of bytes it placed and does not add a null byte, so `strlen()` read past the target into old buffer contents and the caller got a wrong length. This PR returns the length that the file system gives. `readlink()` of a pseudo-file-system link is not changed. ## Impact `readlink()` on mounted file systems that implement `readlink` (hostfs, rpmsgfs, and v9fs with the companion PR) returns the right length. ## Testing The run-time tests ran on a local branch that has this change and other pending changes on top of master; the builds are of this branch alone. qemu-armv8a, kernel build, QEMU 11 with HVF, a 9P share with v9fs `readlink()` (companion PR): `readlink flink dlink uplink` printed `d/sub/f.txt`, `d` and `../lt/d/sub/f.txt` followed by stray bytes from the buffer before; after, it prints exactly the three targets. Builds with `-Wno-cpp -Werror`: `qemu-armv8a:netnsh`, `qemu-armv8a:nsh` with `CONFIG_FS_LINKS=y`, `lm3s6965-ek:qemu-flat`. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
