diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index e138041a..d7fca3b3 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -611,6 +611,7 @@ static int do_i2s_cmd(int argc, char **argv) } if(i2s_args.model_name->count>0 && strlen(i2s_args.model_name->sval[0])>0){ strncpy(i2s_dac_pin.model,i2s_args.model_name->sval[0],sizeof(i2s_dac_pin.model)); + i2s_dac_pin.model[sizeof(i2s_dac_pin.model) - 1] = '\0'; } if(!nerrors ){ fprintf(f,"Storing i2s parameters.\n"); diff --git a/components/platform_console/cmd_wifi.c b/components/platform_console/cmd_wifi.c index eeaad2f0..558c3c9f 100644 --- a/components/platform_console/cmd_wifi.c +++ b/components/platform_console/cmd_wifi.c @@ -117,8 +117,10 @@ static bool wifi_join(const char *ssid, const char *pass, int timeout_ms) initialise_wifi(); wifi_config_t wifi_config = { 0 }; strncpy((char *) wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid)); + wifi_config.sta.ssid[sizeof(wifi_config.sta.ssid) - 1] = '\0'; if (pass) { strncpy((char *) wifi_config.sta.password, pass, sizeof(wifi_config.sta.password)); + wifi_config.sta.password[sizeof(wifi_config.sta.password) - 1] = '\0'; } ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); diff --git a/components/services/buttons.c b/components/services/buttons.c index 8289eed5..d734dec7 100644 --- a/components/services/buttons.c +++ b/components/services/buttons.c @@ -47,14 +47,14 @@ static EXT_RAM_ATTR struct button_s { TimerHandle_t timer; } buttons[MAX_BUTTONS]; -static struct { +static EXT_RAM_ATTR struct { int gpio, level; struct button_s *button; } polled_gpio[] = { {36, -1, NULL}, {39, -1, NULL}, {-1, -1, NULL} }; static TimerHandle_t polled_timer; -static struct { +static EXT_RAM_ATTR struct { QueueHandle_t queue; void *client; rotary_encoder_info_t info; @@ -62,7 +62,7 @@ static struct { rotary_handler handler; } rotary; -static struct { +static EXT_RAM_ATTR struct { RingbufHandle_t rb; infrared_handler handler; } infrared; diff --git a/components/services/led.c b/components/services/led.c index 8432457a..1f2fedbe 100644 --- a/components/services/led.c +++ b/components/services/led.c @@ -28,7 +28,7 @@ static const char *TAG = "led"; -static struct led_s { +static EXT_RAM_ATTR struct led_s { gpio_num_t gpio; bool on; int onstate; @@ -40,7 +40,7 @@ static struct led_s { TimerHandle_t timer; } leds[MAX_LED]; -static struct { +static EXT_RAM_ATTR struct { int gpio; int active; int pwm; diff --git a/components/squeezelite/displayer.c b/components/squeezelite/displayer.c index 03941001..36d6c650 100644 --- a/components/squeezelite/displayer.c +++ b/components/squeezelite/displayer.c @@ -244,8 +244,7 @@ static void visu_handler(u8_t *data, int len); static void dmxt_handler(u8_t *data, int len); static void displayer_task(void* arg); -// PLACEHOLDER -void *led_display = 0x1000; +void *led_display; /* scrolling undocumented information grfs @@ -537,7 +536,8 @@ static void show_display_buffer(char *ddram) { char *line2; memset(line1, 0, LINELEN+1); - strncpy(line1, ddram, LINELEN); + strncpy(line1, ddram, LINELEN+1); + line1[LINELEN] = '\0'; line2 = &(ddram[LINELEN]); line2[LINELEN] = '\0'; diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index d44014f3..0be48ca8 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/components/wifi-manager/wifi_manager.c @@ -292,6 +292,7 @@ void wifi_manager_init_wifi(){ void set_lms_server_details(in_addr_t ip, u16_t hport, u16_t cport){ strncpy(lms_server_ip,inet_ntoa(ip),sizeof(lms_server_ip)); + lms_server_ip[sizeof(lms_server_ip)-1]='\0'; ESP_LOGI(TAG,"LMS IP: %s, hport: %d, cport: %d",lms_server_ip, hport, cport); lms_server_port = hport; lms_server_cport = cport;