diff options
author | Bjorn Munch <bjorn.munch@oracle.com> | 2011-01-11 10:54:42 +0100 |
---|---|---|
committer | Bjorn Munch <bjorn.munch@oracle.com> | 2011-01-11 10:54:42 +0100 |
commit | 5376a76dea7cd8b15c4b95911a18233fc924d305 (patch) | |
tree | 00ec5ed4f78c3845f192d75410a28a9b6c94eb9d /client | |
parent | f3bc9f699cb37bbecc24efbb46d2fdba01dcbb42 (diff) | |
download | mariadb-git-5376a76dea7cd8b15c4b95911a18233fc924d305.tar.gz |
Bug #58900 query_get_value crashes when result begins with dollar sign
Generalized fix for recursive backtick
Optional arg to eval_expr telling it not to interpret
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 38f8516f7da..feed964c2fa 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -474,7 +474,7 @@ VAR* var_init(VAR* v, const char *name, int name_len, const char *val, void var_free(void* v); VAR* var_get(const char *var_name, const char** var_name_end, my_bool raw, my_bool ignore_not_existing); -void eval_expr(VAR* v, const char *p, const char** p_end, bool backtick= true); +void eval_expr(VAR* v, const char *p, const char** p_end, bool do_eval= true); my_bool match_delimiter(int c, const char *delim, uint length); void dump_result_to_reject_file(char *buf, int size); void dump_warning_messages(); @@ -2371,7 +2371,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var) break; } } - eval_expr(var, value, 0); + eval_expr(var, value, 0, false); } dynstr_free(&ds_query); mysql_free_result(res); @@ -2401,12 +2401,16 @@ void var_copy(VAR *dest, VAR *src) } -void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick) +void eval_expr(VAR *v, const char *p, const char **p_end, bool do_eval) { DBUG_ENTER("eval_expr"); DBUG_PRINT("enter", ("p: '%s'", p)); + /* Skip to treat as pure string if no evaluation */ + if (! do_eval) + goto NO_EVAL; + if (*p == '$') { VAR *vp; @@ -2426,7 +2430,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick) DBUG_VOID_RETURN; } - if (*p == '`' && backtick) + if (*p == '`') { var_query_set(v, p, p_end); DBUG_VOID_RETURN; @@ -2449,6 +2453,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick) } } + NO_EVAL: { int new_val_len = (p_end && *p_end) ? (int) (*p_end - p) : (int) strlen(p); |