Commit Graph
20 Commits
Author SHA1 Message Date
Peter Barker c5022fd90c AP_ROMFS: don't list a file as though it were a directory
dir_list() accepted a name matching dirname exactly, so opendir() of a
file's path succeeded, and readdir() then skipped past the end of that
file's name, taking the name from whatever followed it in memory. Over
MAVFTP, listing a path such as @ROMFS/locations.txt was enough.

Match only names with a separator after dirname.
2026-09-24 18:35:09 +10:00
Peter Barker bbb6c224aa AP_ROMFS: list a directory which follows a file named like it
dir_list() lists a directory once, for its first file, by skipping any
file whose leading directory matches the previous file's. It compared
the directory's name without the separator after it, so "sub.txt",
which sorts just before "sub/", was taken for it and the directory was
never listed. At the top level the name was also taken to start one
character in.

Compare through the separator, from the start of the name.
2026-09-24 18:35:09 +10:00
Peter Barker 818be63b54 AP_ROMFS: don't read past a shorter name when skipping duplicate directories
dir_list() compares an entry's leading directory with the previous
entry's using memcmp() over the directory's length, which reads past the
end of the previous name when that is shorter. strncmp() stops at its
end.
2026-09-24 18:35:09 +10:00
Thomas Watson a5764b7413 AP_ROMFS: clarify usage and null termination
Also remove the redundant insertion of the null terminator.
2024-05-04 10:15:44 +10:00
Andrew Tridgell aa7ae2327d AP_ROMFS: added find_size() 2024-03-19 19:49:47 +11:00
Andrew Tridgell feff639c15 AP_ROMFS: fixed duplicate directories 2024-02-22 07:43:16 +11:00
Iampete1 785e0c4c62 AP_ROMFS: don't require / in filename 2024-02-22 07:43:16 +11:00
Thomas Watson 52468f0238 AP_ROMFS: fix buffer null terminator
Ensure buffer is properly null terminated without changing the indicated
size even for uncompressed data.
2024-01-25 11:24:31 +11:00
Thomas Watson d13193150c AP_ROMFS: store size in file structure instead of compressed stream
Cleans up code.
2024-01-25 11:24:31 +11:00
Thomas Watson d46cb3fd85 AP_ROMFS: embed raw DEFLATE streams
Saves size not including unnecessary headers or code to parse them.
2024-01-25 11:24:31 +11:00
Peter Barker 5bc20af9d6 AP_ROMFS: tidy includes 2022-05-03 09:14:58 +10:00
Andrew Tridgell f7098c1635 AP_ROMFS: added crc check in ROMFS decompression 2021-02-23 20:20:07 +11:00
Andrew Tridgell 98542d0c0b AP_ROMFS: added directory listing interface 2020-03-28 15:28:03 +11:00
Andrew Tridgell cfed364dd0 AP_ROMFS: fixed build warning 2019-12-20 16:50:48 +11:00
Andrew Tridgell 7fb44d1164 AP_ROMFS: fixed return size for uncompressed ROMFS 2019-10-25 21:36:55 +11:00
Andrew Tridgell 1a1d7e0525 AP_ROMFS: support uncompressed romfs data 2019-10-24 22:03:43 +11:00
Michael du Breuil 0acb1103b0 AP_ROMFS: make all decompressions null terminated 2018-10-30 16:17:03 -07:00
Lucas De Marchi 668c941717 Global: use new version of ARRAY_SIZE 2018-08-04 15:31:55 +10:00
Andrew Tridgell c3db5c3da2 AP_ROMFS: added support for compressed files in ROMFS 2018-07-09 19:41:56 +10:00
Andrew Tridgell deae66e645 AP_ROMFS: library for embedding files
this will be used for bootloaders and IO firmware
2018-04-17 08:44:44 +10:00