diff options
author | midipix <writeonce@midipix.org> | 2017-01-16 04:37:53 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-01-16 01:52:26 -0500 |
commit | d16b427bc946660da1b5a4421aacb585dd0a07ad (patch) | |
tree | bf4db1bcef63d9797c014fb382bf117c8cf5eb1f /src | |
parent | cd4191db5ebcb3ca96c5d5eb4336eddd895445bf (diff) | |
download | ntapi-d16b427bc946660da1b5a4421aacb585dd0a07ad.tar.bz2 ntapi-d16b427bc946660da1b5a4421aacb585dd0a07ad.tar.xz |
__ntapi_dsr_start_impl(): copy the loop routine addr and ctx onto the stack.
Since params might point to an address on the stack of the thread which
called __ntapi_dsr_init(), and given that __ntapi_dsr_init() returns as
soon as the internal client connection had been established, we may not
access params upon return from __ntapi_dsr_connect_internal_client().
Diffstat (limited to 'src')
-rw-r--r-- | src/daemon/ntapi_dsr_init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/daemon/ntapi_dsr_init.c b/src/daemon/ntapi_dsr_init.c index b54131e..f556f0b 100644 --- a/src/daemon/ntapi_dsr_init.c +++ b/src/daemon/ntapi_dsr_init.c @@ -145,8 +145,10 @@ static int32_t __ntapi_dsr_start_impl(nt_daemon_params * params) { int32_t status; void * ctx; + int32_t (*loop)(void *); - ctx = params->daemon_loop_context; + ctx = params->daemon_loop_context; + loop = params->daemon_loop_routine; if ((status = __ntapi_dsr_once(params))) return status; @@ -157,7 +159,7 @@ static int32_t __ntapi_dsr_start_impl(nt_daemon_params * params) if ((status = __ntapi_dsr_connect_internal_client(params))) return status; - if ((status = params->daemon_loop_routine(ctx))) + if ((status = loop(ctx))) return status; return NT_STATUS_SUCCESS; |