mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-06 11:22:15 +02:00
add null terminator
This commit is contained in:
parent
71e8162436
commit
a19bbf6e4f
@ -86,7 +86,8 @@ static Result _capmtpOpenSession(Service *srv) {
|
|||||||
|
|
||||||
static Result _capmtpOpen(u32 max_folders, u32 max_img, u32 max_vid, const char *other_name) {
|
static Result _capmtpOpen(u32 max_folders, u32 max_img, u32 max_vid, const char *other_name) {
|
||||||
u16 buffer[0x100];
|
u16 buffer[0x100];
|
||||||
size_t len = utf8_to_utf16(buffer, (const u8*)other_name, sizeof(buffer)/sizeof(u16));
|
size_t len = utf8_to_utf16(buffer, (const u8*)other_name, sizeof(buffer)/sizeof(u16) - 1);
|
||||||
|
buffer[len] = 0;
|
||||||
const struct {
|
const struct {
|
||||||
u32 tmem_size;
|
u32 tmem_size;
|
||||||
u32 folder_count;
|
u32 folder_count;
|
||||||
@ -96,7 +97,7 @@ static Result _capmtpOpen(u32 max_folders, u32 max_img, u32 max_vid, const char
|
|||||||
|
|
||||||
return serviceDispatchIn(&g_capmtp, 0, in,
|
return serviceDispatchIn(&g_capmtp, 0, in,
|
||||||
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcMapAlias },
|
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcMapAlias },
|
||||||
.buffers = { { buffer, 2*len } },
|
.buffers = { { buffer, 2*(len+1) } },
|
||||||
.in_num_handles = 1,
|
.in_num_handles = 1,
|
||||||
.in_handles = { g_tmem.handle },
|
.in_handles = { g_tmem.handle },
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user