aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/c/urweb.c
diff options
context:
space:
mode:
authorGravatar Sergey Mironov <grrwlf@gmail.com>2014-02-26 09:43:47 +0000
committerGravatar Sergey Mironov <grrwlf@gmail.com>2014-02-26 09:43:47 +0000
commit48d55244e59e2b041077a3060eb3b6d6f9ecfd65 (patch)
tree2d0cfe6f1f967402e770625b263d1a3a38670200 /src/c/urweb.c
parent640c7fe665f5f37fed005b2c9fe96c4818cc7043 (diff)
Protect uw_Basis_new_client_source from invalid ctx->id
We assume that FFI code may create new contextes with id left unassigned
Diffstat (limited to 'src/c/urweb.c')
-rw-r--r--src/c/urweb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index f2c37885..df137e77 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1586,6 +1586,9 @@ uw_Basis_source uw_Basis_new_client_source(uw_context ctx, uw_Basis_string s) {
int len;
size_t s_len = strlen(s);
+ if(ctx->id < 0)
+ uw_error(ctx, FATAL, "Attempt to create client source using inappropriate context");
+
uw_check_script(ctx, 15 + 2 * INTS_MAX + s_len);
sprintf(ctx->script.front, "s%d_%llu=sc(exec(%n", ctx->id, ctx->source_count, &len);
ctx->script.front += len;