From 77c0f33ee2b2ad46088364630275735f9d744ed2 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Fri, 11 Feb 2011 15:00:09 +0100 Subject: Fix for BUG#59894 "set optimizer_switch to e or d causes invalid memory writes/valgrind warnings": due to prefix support, the argument "e" was overwritten with its full value "engine_condition_pushdown", which caused a buffer overrun. This was wrong usage of find_type(); other wrong usages are fixed here too. Please start reading with the comment of typelib.c. --- sql/sql_help.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sql/sql_help.cc') diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 7d106fbe936..858205f8da6 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -284,10 +284,12 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations, Field *rtopic_id, *rkey_id; DBUG_ENTER("get_topics_for_keyword"); - if ((iindex_topic= find_type((char*) primary_key_name, - &topics->s->keynames, 1+2)-1)<0 || - (iindex_relations= find_type((char*) primary_key_name, - &relations->s->keynames, 1+2)-1)<0) + if ((iindex_topic= + find_type(primary_key_name, &topics->s->keynames, + FIND_TYPE_NO_PREFIX) - 1) < 0 || + (iindex_relations= + find_type(primary_key_name, &relations->s->keynames, + FIND_TYPE_NO_PREFIX) - 1) < 0) { my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0)); DBUG_RETURN(-1); -- cgit v1.2.1