mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-16 10:39:49 +00:00
Add config var size check
This commit is contained in:
1 parent
4d06f33089
commit
bff1462e9e
2 files changed
+8
-1
No files matched your search
@@ -188,7 +188,12 @@ static void handle_settings_set(struct mg_connection *c, struct mg_str body) {
|
||||
settings.log_level = mg_json_get_long(body, "$.log_level", 0);
|
||||
settings.brightness = mg_json_get_long(body, "$.brightness", 0);
|
||||
char *s = mg_json_get_str(body, "$.device_name");
|
||||
if (s) free(settings.device_name), settings.device_name = s;
|
||||
if (s && strlen(s) < MAX_DEVICE_NAME) {
|
||||
free(settings.device_name);
|
||||
settings.device_name = s;
|
||||
} else {
|
||||
free(s);
|
||||
}
|
||||
|
||||
// Save to the device flash
|
||||
s_settings = settings;
|
||||
|
||||
@@ -12,4 +12,6 @@
|
||||
#define HTTPS_URL "http://0.0.0.0:8443"
|
||||
#endif
|
||||
|
||||
#define MAX_DEVICE_NAME 40
|
||||
|
||||
void web_init(struct mg_mgr *mgr);
|
||||
Reference in new issue
Block a user