summaryrefslogtreecommitdiff
path: root/src
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
commitecab43a27e7757479201d3c0ac3879c403073708 (patch)
tree2d0cfe6f1f967402e770625b263d1a3a38670200 /src
parent4f43eb61c7218b1440e217b86c35a9317def94f0 (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')
-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;