mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
tinyusb: Fix a strncpy-related warning caused by a wrong argument
The issue was in using with `strncpy` a size of source array instead of using a size of destination array.
This commit is contained in:
parent
96d59ff3e9
commit
ab33f55e1b
@ -83,11 +83,11 @@ static esp_err_t apply_path(char const *path)
|
||||
ESP_LOGE(TAG, "The path is too long; maximum is %d characters", VFS_TUSB_MAX_PATH);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
strncpy(s_vfstusb.vfs_path, path, path_len);
|
||||
strncpy(s_vfstusb.vfs_path, path, (VFS_TUSB_MAX_PATH - 1));
|
||||
} else {
|
||||
strncpy(s_vfstusb.vfs_path,
|
||||
VFS_TUSB_PATH_DEFAULT,
|
||||
strlen(VFS_TUSB_PATH_DEFAULT) + 1);
|
||||
(VFS_TUSB_MAX_PATH - 1));
|
||||
}
|
||||
ESP_LOGV(TAG, "Path is set to `%s`", s_vfstusb.vfs_path);
|
||||
return ESP_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user