Commit 0ab1c7ef authored by Dmitry Frank's avatar Dmitry Frank Committed by Cesanta Bot

Fail if passed a NULL handler

Before it resulted in an endless recursion.

Resolves https://github.com/cesanta/mongoose/issues/871

CL: Mongoose Web Server: Fail if passed a NULL handler to `mg_bind` or `mg_bind_opt`.

PUBLISHED_FROM=376e5d330a643fa530f6a27a422a1500f986c721
parent 47abc641
...@@ -3046,6 +3046,11 @@ struct mg_connection *mg_bind_opt(struct mg_mgr *mgr, const char *address, ...@@ -3046,6 +3046,11 @@ struct mg_connection *mg_bind_opt(struct mg_mgr *mgr, const char *address,
opts.user_data = user_data; opts.user_data = user_data;
#endif #endif
if (callback == NULL) {
MG_SET_PTRPTR(opts.error_string, "handler is required");
return NULL;
}
MG_COPY_COMMON_CONNECTION_OPTIONS(&add_sock_opts, &opts); MG_COPY_COMMON_CONNECTION_OPTIONS(&add_sock_opts, &opts);
#if MG_ENABLE_TUN #if MG_ENABLE_TUN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment