global: fix some potential out-of-bounds issue

...that found by Coverity Scan
pull/8779/head
morris 2022-04-07 19:14:37 +08:00
rodzic bb2a57dc71
commit 483149e41b
3 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -713,8 +713,9 @@ esp_err_t rmt_config(const rmt_config_t *rmt_param)
static void IRAM_ATTR rmt_fill_memory(rmt_channel_t channel, const rmt_item32_t *item,
uint16_t item_num, uint16_t mem_offset)
{
volatile uint32_t *to = (volatile uint32_t *)&RMTMEM.chan[channel].data32[mem_offset].val;
uint32_t *from = (uint32_t *)item;
volatile uint32_t *to = (volatile uint32_t *)&RMTMEM.chan[channel].data32[0].val;
to += mem_offset;
while (item_num--) {
*to++ = *from++;
}

Wyświetl plik

@ -107,7 +107,7 @@ static void esp_ipc_init(void) __attribute__((constructor));
static void esp_ipc_init(void)
{
char task_name[15];
char task_name[configMAX_TASK_NAME_LEN];
for (int i = 0; i < portNUM_PROCESSORS; ++i) {
snprintf(task_name, sizeof(task_name), "ipc%d", i);

Wyświetl plik

@ -167,7 +167,7 @@ esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t
esp_err_t esp_vfs_unregister_with_id(esp_vfs_id_t vfs_id)
{
if (vfs_id < 0 || vfs_id >= MAX_FDS || s_vfs[vfs_id] == NULL) {
if (vfs_id < 0 || vfs_id >= VFS_MAX_COUNT || s_vfs[vfs_id] == NULL) {
return ESP_ERR_INVALID_ARG;
}
vfs_entry_t* vfs = s_vfs[vfs_id];