diff --git a/components/bootloader_support/src/bootloader_common.c b/components/bootloader_support/src/bootloader_common.c index 98e5606ede..12f60e9ce1 100644 --- a/components/bootloader_support/src/bootloader_common.c +++ b/components/bootloader_support/src/bootloader_common.c @@ -134,7 +134,7 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat fl_ota_data_erase = true; } // partition->label is not null-terminated string. - strncpy(label, (char *)&partition->label, sizeof(partition->label)); + strncpy(label, (char *)&partition->label, sizeof(label) - 1); if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) { err = esp_rom_spiflash_erase_area(partition->pos.offset, partition->pos.size); if (err != ESP_OK) { diff --git a/components/esp32/ipc.c b/components/esp32/ipc.c index aedf4edb3b..6319a621d7 100644 --- a/components/esp32/ipc.c +++ b/components/esp32/ipc.c @@ -77,7 +77,7 @@ void esp_ipc_init() { s_ipc_mutex = xSemaphoreCreateMutex(); s_ipc_ack = xSemaphoreCreateBinary(); - char task_name[8]; + char task_name[15]; for (int i = 0; i < portNUM_PROCESSORS; ++i) { sprintf(task_name,"ipc%d",i); s_ipc_sem[i] = xSemaphoreCreateBinary(); diff --git a/components/fatfs/src/ff.c b/components/fatfs/src/ff.c index 4225a044ce..b87b9b4303 100644 --- a/components/fatfs/src/ff.c +++ b/components/fatfs/src/ff.c @@ -2236,7 +2236,7 @@ void init_alloc_info ( /* exFAT: Load the object's directory entry block */ /*------------------------------------------------*/ static -FRESULT load_obj_xdir ( +FRESULT load_obj_xdir ( FF_DIR* dp, /* Blank directory object to be used to access containing direcotry */ const FFOBJID* obj /* Object with its containing directory information */ ) @@ -5975,7 +5975,7 @@ FRESULT f_fdisk ( BYTE s_hd, e_hd, *p, *buf = (BYTE*)work; DSTATUS stat; DWORD sz_disk, sz_part, s_part; - DWORD cluster_size = CLUSTER_SIZE; + DWORD cluster_size = CLUSTER_SIZE; FRESULT res; @@ -5991,14 +5991,17 @@ FRESULT f_fdisk ( if (!buf) return FR_NOT_ENOUGH_CORE; /* Determine the CHS without any consideration of the drive geometry */ - for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2) ; + for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2) + { + ; + } if (n == 256) n--; - if (sz_disk < SUPPORTED_FLASH_SIZE) { - cluster_size = 1; - n = sz_disk; - } + if (sz_disk < SUPPORTED_FLASH_SIZE) { + cluster_size = 1; + n = sz_disk; + } e_hd = n - 1; - sz_cyl = cluster_size * n; + sz_cyl = cluster_size * n; tot_cyl = sz_disk / sz_cyl; /* Create partition table */ @@ -6011,7 +6014,7 @@ FRESULT f_fdisk ( sz_part = (DWORD)sz_cyl * p_cyl; if (i == 0) { /* Exclude first track of cylinder 0 */ s_hd = 1; - s_part += cluster_size; sz_part -= cluster_size; + s_part += cluster_size; sz_part -= cluster_size; } else { s_hd = 0; } diff --git a/components/newlib/include/sys/reent.h b/components/newlib/include/sys/reent.h index ee40961894..b35595a7d4 100644 --- a/components/newlib/include/sys/reent.h +++ b/components/newlib/include/sys/reent.h @@ -402,7 +402,7 @@ struct _reent char *_asctime_buf; /* signal info */ - void (**(_sig_func))(int); + void (**_sig_func)(int); # ifndef _REENT_GLOBAL_ATEXIT /* atexit stuff */ diff --git a/components/spi_flash/partition.c b/components/spi_flash/partition.c index 4003291999..7f63d4c343 100644 --- a/components/spi_flash/partition.c +++ b/components/spi_flash/partition.c @@ -176,7 +176,7 @@ static esp_err_t load_partitions() } // it->label may not be zero-terminated - strncpy(item->info.label, (const char*) it->label, sizeof(it->label)); + strncpy(item->info.label, (const char*) it->label, sizeof(item->info.label) - 1); item->info.label[sizeof(it->label)] = 0; // add it to the list if (last == NULL) { diff --git a/components/wpa_supplicant/src/wpa2/eap_peer/eap.c b/components/wpa_supplicant/src/wpa2/eap_peer/eap.c index 865da65470..10fc2257bd 100644 --- a/components/wpa_supplicant/src/wpa2/eap_peer/eap.c +++ b/components/wpa_supplicant/src/wpa2/eap_peer/eap.c @@ -407,7 +407,7 @@ int eap_peer_blob_init(struct eap_sm *sm) ret = -2; goto _out; } - os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN); + os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1); sm->blob[0].len = g_wpa_client_cert_len; sm->blob[0].data = g_wpa_client_cert; } @@ -418,7 +418,7 @@ int eap_peer_blob_init(struct eap_sm *sm) ret = -2; goto _out; } - os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN); + os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1); sm->blob[1].len = g_wpa_private_key_len; sm->blob[1].data = g_wpa_private_key; } @@ -429,7 +429,7 @@ int eap_peer_blob_init(struct eap_sm *sm) ret = -2; goto _out; } - os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN); + os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1); sm->blob[2].len = g_wpa_ca_cert_len; sm->blob[2].data = g_wpa_ca_cert; }