summaryrefslogtreecommitdiff
path: root/client/mysqltest.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r--client/mysqltest.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index f700ea9479d..09d6292f0a0 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -2184,8 +2184,16 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
if (*p == '$')
{
VAR *vp;
+ const char* expected_end= *p_end; // Remember var end
if ((vp= var_get(p, p_end, 0, 0)))
var_copy(v, vp);
+
+ /* Make sure there was just a $variable and nothing else */
+ const char* end= *p_end + 1;
+ if (end < expected_end)
+ die("Found junk '%.*s' after $variable in expression",
+ expected_end - end - 1, end);
+
DBUG_VOID_RETURN;
}