Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kernel] Fix crash when accessing 15+ character filename on FAT #2009

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions elks/fs/msdos/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ static int FATPROC msdos_find_long(struct inode *dir, const char *name, int len,
int i, entry_len, res;
off_t dirpos, pos = 0;
int nocase = 0;
ASYNCIO_REENTRANT char entry_name[14];
ASYNCIO_REENTRANT char msdos_name[14];
ASYNCIO_REENTRANT char entry_name[MAXNAMLEN]; /* FIXME large stack usage */
ASYNCIO_REENTRANT char msdos_name[MAXNAMLEN]; /* FIXME large stack usage */

if (len > MAXNAMLEN)
return -ENOENT;
for (i=0; i<len; i++)
msdos_name[i] = get_fs_byte(name++);

Expand Down
2 changes: 1 addition & 1 deletion elkscmd/basic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ OBJS += host-8018x.o
endif

ifeq ($(CONFIG_ARCH_PC98), y)
OBJS += host-pc98.o intC5-pc98.o
OBJS += host-pc98.o asm-pc98.o
endif

HOSTPRGS = hostbasic
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion elkscmd/basic/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ int parseLoadSaveCmd() {
if (executeMode) {
if (gotFileName) {
char fileName[MAX_PATH_LEN];
if (strlen(stackGetStr()) >= MAX_IDENT_LEN)
if (strlen(stackGetStr()) > MAX_PATH_LEN-1)
return ERROR_BAD_PARAMETER;
strcpy(fileName, stackPopStr());
#if DISK_FUNCTIONS
Expand Down
File renamed without changes.
Loading