Merge pull request #109 from StefanBruens/sanitize_config_strings

Sanitize config strings
develop
Tuan PM 2016-06-01 16:32:23 +07:00
commit 368c1aad63
2 zmienionych plików z 8 dodań i 7 usunięć

Wyświetl plik

@ -87,15 +87,16 @@ CFG_Load()
sysCfg.cfg_holder = CFG_HOLDER;
os_sprintf(sysCfg.sta_ssid, "%s", STA_SSID);
os_sprintf(sysCfg.sta_pwd, "%s", STA_PASS);
os_sprintf(sysCfg.device_id, MQTT_CLIENT_ID, system_get_chip_id());
sysCfg.device_id[sizeof(sysCfg.device_id) - 1] = '\0';
os_strncpy(sysCfg.sta_ssid, STA_SSID, sizeof(sysCfg.sta_ssid) - 1);
os_strncpy(sysCfg.sta_pwd, STA_PASS, sizeof(sysCfg.sta_pwd) - 1);
sysCfg.sta_type = STA_TYPE;
os_sprintf(sysCfg.device_id, MQTT_CLIENT_ID, system_get_chip_id());
os_sprintf(sysCfg.mqtt_host, "%s", MQTT_HOST);
os_strncpy(sysCfg.mqtt_host, MQTT_HOST, sizeof(sysCfg.mqtt_host) - 1);
sysCfg.mqtt_port = MQTT_PORT;
os_sprintf(sysCfg.mqtt_user, "%s", MQTT_USER);
os_sprintf(sysCfg.mqtt_pass, "%s", MQTT_PASS);
os_strncpy(sysCfg.mqtt_user, MQTT_USER, sizeof(sysCfg.mqtt_user) - 1);
os_strncpy(sysCfg.mqtt_pass, MQTT_PASS, sizeof(sysCfg.mqtt_pass) - 1);
sysCfg.security = DEFAULT_SECURITY; /* default non ssl */

Wyświetl plik

@ -34,7 +34,7 @@
#include "user_config.h"
typedef struct{
uint32_t cfg_holder;
uint8_t device_id[16];
uint8_t device_id[32];
uint8_t sta_ssid[64];
uint8_t sta_pwd[64];