fix some possible buffer overflows
This commit is contained in:
@@ -117,8 +117,8 @@ int weather_fetch_forecast( weather_config_t *weather_config, weather_forcast_t
|
||||
snprintf( weather_forecast[ i ].temp, sizeof( weather_forecast[ i ].temp ),"%0.1f°%s", doc["list"][i]["main"]["temp"].as<float>(), weather_units_symbol );
|
||||
snprintf( weather_forecast[ i ].humidity, sizeof( weather_forecast[ i ].humidity ),"%f%%", doc["list"][i]["main"]["humidity"].as<float>() );
|
||||
snprintf( weather_forecast[ i ].pressure, sizeof( weather_forecast[ i ].pressure ),"%fpha", doc["list"][i]["main"]["pressure"].as<float>() );
|
||||
strcpy( weather_forecast[ i ].icon, doc["list"][i]["weather"][0]["icon"] );
|
||||
strcpy( weather_forecast[ i ].name, doc["city"]["name"] );
|
||||
strlcpy( weather_forecast[ i ].icon, doc["list"][i]["weather"][0]["icon"], sizeof( weather_forecast[ i ].icon ) );
|
||||
strlcpy( weather_forecast[ i ].name, doc["city"]["name"], sizeof( weather_forecast[ i ].name ) );
|
||||
|
||||
int directionDegree = doc["list"][i]["wind"]["deg"].as<int>();
|
||||
int speed = doc["list"][i]["wind"]["speed"].as<int>();
|
||||
|
||||
@@ -250,9 +250,9 @@ static void exit_weather_widget_setup_event_cb( lv_obj_t * obj, lv_event_t event
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): keyboard_hide();
|
||||
weather_config_t *weather_config = weather_get_config();
|
||||
strcpy( weather_config->apikey, lv_textarea_get_text( weather_apikey_textfield ) );
|
||||
strcpy( weather_config->lat, lv_textarea_get_text( weather_lat_textfield ) );
|
||||
strcpy( weather_config->lon, lv_textarea_get_text( weather_lon_textfield ) );
|
||||
strlcpy( weather_config->apikey, lv_textarea_get_text( weather_apikey_textfield ), sizeof( weather_config->apikey ) );
|
||||
strlcpy( weather_config->lat, lv_textarea_get_text( weather_lat_textfield ), sizeof( weather_config->lat ) );
|
||||
strlcpy( weather_config->lon, lv_textarea_get_text( weather_lon_textfield ), sizeof( weather_config->lon ) );
|
||||
weather_save_config();
|
||||
weather_jump_to_forecast();
|
||||
break;
|
||||
@@ -280,9 +280,9 @@ void bluetooth_message_msg_pharse( char* msg ) {
|
||||
if ( !strcmp( doc["app"], "weather" ) ) {
|
||||
|
||||
weather_config_t *weather_config = weather_get_config();
|
||||
strcpy( weather_config->apikey, doc["apikey"] );
|
||||
strcpy( weather_config->lat, doc["lat"] );
|
||||
strcpy( weather_config->lon, doc["lon"] );
|
||||
strlcpy( weather_config->apikey, doc["apikey"], sizeof( weather_config->apikey ) );
|
||||
strlcpy( weather_config->lat, doc["lat"], sizeof( weather_config->lat ) );
|
||||
strlcpy( weather_config->lon, doc["lon"], sizeof( weather_config->lon ) );
|
||||
weather_save_config();
|
||||
motor_vibe(100);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user