Re: [PATCH] vvfat: refresh writing long filename

2025-01-19 Thread Michael Tokarev
19.01.2025 04:07, BALATON Zoltan wrote: On Sun, 19 Jan 2025, Michael Tokarev wrote: 18.01.2025 23:54, BALATON Zoltan wrote: +typedef struct lfn_direntry_t { +    uint8_t sequence; +    uint8_t name01[10]; +    uint8_t attributes; +    uint8_t direntry_type; +    uint8_t sfn_checksum; +    uint8

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread BALATON Zoltan
On Sun, 19 Jan 2025, Michael Tokarev wrote: 18.01.2025 23:54, BALATON Zoltan wrote: +typedef struct lfn_direntry_t { +    uint8_t sequence; +    uint8_t name01[10]; +    uint8_t attributes; +    uint8_t direntry_type; +    uint8_t sfn_checksum; +    uint8_t name0e[12]; +    uint16_t begin; +   

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread Volker Rümelin
Am 18.01.25 um 21:55 schrieb Michael Tokarev: > 18.01.2025 23:32, Volker Rümelin wrote: > >> The rules are: >> If the file name length in characters is a multiple of 13 you are done. >> Otherwise the remaining unused LFN direntry name array elements have to >> be filled with one 0x (a 16 bit 0)

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread Michael Tokarev
18.01.2025 23:54, BALATON Zoltan wrote: +typedef struct lfn_direntry_t { +    uint8_t sequence; +    uint8_t name01[10]; +    uint8_t attributes; +    uint8_t direntry_type; +    uint8_t sfn_checksum; +    uint8_t name0e[12]; +    uint16_t begin; +    uint8_t name1c[4]; +} QEMU_PACKED lfn_dirent

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread Michael Tokarev
18.01.2025 23:32, Volker Rümelin wrote: The rules are: If the file name length in characters is a multiple of 13 you are done. Otherwise the remaining unused LFN direntry name array elements have to be filled with one 0x (a 16 bit 0) and the rest with 0x. BTW, are we really okay with a

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread BALATON Zoltan
On Sat, 18 Jan 2025, Michael Tokarev wrote: In function create_long_filname(), the array name[8 + 3] in struct direntry_t is used as if it were defined as name[32]. This is intentional and works. It's nevertheless an out of bounds array access. To avoid this problem, this patch adds a struct lfn_

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread Michael Tokarev
18.01.2025 23:32, Volker Rümelin wrote: +static unsigned write_lfn_part(uint8_t *dest, unsigned dsize, + const gunichar2 *lptr, const gunichar2 *lend) +{ +unsigned i; +for(i = 0; i < dsize / 2 && lptr + i < lend; ++i) { +dest[i / 2 + 0] = lptr[i] & 0

Re: [PATCH] vvfat: refresh writing long filename

2025-01-18 Thread Volker Rümelin
Am 18.01.25 um 18:35 schrieb Michael Tokarev: > In function create_long_filname(), the array name[8 + 3] in > struct direntry_t is used as if it were defined as name[32]. > This is intentional and works. It's nevertheless an out of > bounds array access. To avoid this problem, this patch adds a > s

[PATCH] vvfat: refresh writing long filename

2025-01-18 Thread Michael Tokarev
In function create_long_filname(), the array name[8 + 3] in struct direntry_t is used as if it were defined as name[32]. This is intentional and works. It's nevertheless an out of bounds array access. To avoid this problem, this patch adds a struct lfn_direntry_t with multiple name arrays. A direct