mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-28 01:58:11 -07:00
Max file name length is actually 253 + null term
More than that and fatfs will truncate like name~1 Also dir_read already accounts for null term in buf size, dont malloc +1
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
#define TAG "libmgr"
|
||||
|
||||
#define MAX_NAME_LEN 254
|
||||
|
||||
ARRAY_DEF(FlipperApplicationList, FlipperApplication*, M_PTR_OPLIST)
|
||||
#define M_OPL_FlipperApplicationList_t() ARRAY_OPLIST(FlipperApplicationList, M_PTR_OPLIST)
|
||||
|
||||
@@ -103,7 +105,7 @@ PluginManagerError plugin_manager_load_single(PluginManager* manager, const char
|
||||
|
||||
PluginManagerError plugin_manager_load_all(PluginManager* manager, const char* path) {
|
||||
File* directory = storage_file_alloc(manager->storage);
|
||||
char file_name_buffer[256];
|
||||
char file_name_buffer[MAX_NAME_LEN];
|
||||
FuriString* file_name = furi_string_alloc();
|
||||
do {
|
||||
if(!storage_dir_open(directory, path)) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "dir_walk.h"
|
||||
#include <m-list.h>
|
||||
|
||||
#define MAX_NAME_LEN 254
|
||||
|
||||
LIST_DEF(DirIndexList, uint32_t);
|
||||
|
||||
struct DirWalk {
|
||||
@@ -56,12 +58,12 @@ static bool dir_walk_filter(DirWalk* dir_walk, const char* name, FileInfo* filei
|
||||
static DirWalkResult
|
||||
dir_walk_iter(DirWalk* dir_walk, FuriString* return_path, FileInfo* fileinfo) {
|
||||
DirWalkResult result = DirWalkError;
|
||||
char* name = malloc(256); // FIXME: remove magic number
|
||||
char* name = malloc(MAX_NAME_LEN); // FIXME: remove magic number
|
||||
FileInfo info;
|
||||
bool end = false;
|
||||
|
||||
while(!end) {
|
||||
storage_dir_read(dir_walk->file, &info, name, 255);
|
||||
storage_dir_read(dir_walk->file, &info, name, MAX_NAME_LEN);
|
||||
|
||||
if(storage_file_get_error(dir_walk->file) == FSE_OK) {
|
||||
result = DirWalkOK;
|
||||
@@ -119,7 +121,7 @@ static DirWalkResult
|
||||
break;
|
||||
}
|
||||
|
||||
if(!storage_dir_read(dir_walk->file, &info, name, 255)) {
|
||||
if(!storage_dir_read(dir_walk->file, &info, name, MAX_NAME_LEN)) {
|
||||
result = DirWalkError;
|
||||
end = true;
|
||||
break;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <toolbox/path.h>
|
||||
|
||||
#define TAG "TarArch"
|
||||
#define MAX_NAME_LEN 255
|
||||
#define MAX_NAME_LEN 254
|
||||
#define FILE_BLOCK_SIZE 512
|
||||
|
||||
#define FILE_OPEN_NTRIES 10
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define UPDATE_OPERATION_ROOT_DIR_PACKAGE_MAGIC 0
|
||||
#define UPDATE_OPERATION_MAX_MANIFEST_PATH_LEN 255u
|
||||
#define UPDATE_OPERATION_MAX_MANIFEST_PATH_LEN 254u
|
||||
#define UPDATE_OPERATION_MIN_MANIFEST_VERSION 2
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user