mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 10:32:15 +02:00
Don't copy trailing colons in _fsdevMountDevice().
Fixes fsdev_fixpath() returning NULL when a FsFileSystem object is mounted using a device name with a trailing colon.
This commit is contained in:
parent
1bb1aef2f7
commit
4e8aa07e07
@ -315,7 +315,12 @@ static int _fsdevMountDevice(const char *name, FsFileSystem fs, fsdev_fsdevice *
|
||||
|
||||
device->fs = fs;
|
||||
memset(device->name, 0, sizeof(device->name));
|
||||
strncpy(device->name, name, sizeof(device->name)-1);
|
||||
|
||||
size_t devnamelen = strlen(name);
|
||||
if (devnamelen > (sizeof(device->name) - 1)) devnamelen = (sizeof(device->name) - 1); // Truncate the device name if it's too long
|
||||
if (name[devnamelen - 1] == ':') devnamelen--; // Make sure we don't copy a trailing colon if it was provided
|
||||
|
||||
strncpy(device->name, name, devnamelen);
|
||||
|
||||
int dev = AddDevice(&device->device);
|
||||
if(dev==-1)
|
||||
|
Loading…
Reference in New Issue
Block a user