Quellcode durchsuchen

GENERATED: check the state before using the options

Evgeny Grin (Karlson2k) vor 1 Jahr
Ursprung
Commit
d3b09093c8
2 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 3 0
      src/mhd2/daemon_set_options.c
  2. 3 0
      src/mhd2/response_set_options.c

+ 3 - 0
src/mhd2/daemon_set_options.c

@@ -24,6 +24,9 @@ MHD_daemon_set_options (struct MHD_Daemon *daemon,
 {
   size_t i;
 
+  if (mhd_DAEMON_STATE_NOT_STARTED != daemon->state)
+    return MHD_SC_TOO_LATE;
+
   for (i=0;i<options_max_num;i++)
   {
     const struct MHD_DaemonOptionAndValue *const option = options + i;

+ 3 - 0
src/mhd2/response_set_options.c

@@ -23,6 +23,9 @@ MHD_response_set_options (struct MHD_Response *response,
 {
   size_t i;
 
+  if (response->frozen)
+    return MHD_SC_TOO_LATE;
+
   for (i=0;i<options_max_num;i++)
   {
     const struct MHD_ResponseOptionAndValue *const option = options + i;