diff options
author | Ajo Robert <ajo.robert@oracle.com> | 2017-02-23 18:27:09 +0530 |
---|---|---|
committer | Ajo Robert <ajo.robert@oracle.com> | 2017-02-23 18:27:09 +0530 |
commit | b21a0212e41f876cbc9714ceaa7c7154cfcad69e (patch) | |
tree | fec9c91f8216098df580afdb0d497a79bbde4e01 /sql | |
parent | 7ec26b03a77bdff5cd5f55b259720961cfea11fc (diff) | |
download | mariadb-git-b21a0212e41f876cbc9714ceaa7c7154cfcad69e.tar.gz |
Bug#23195404 EXCESSIVE MEMORY CAN BE USED BY THE QUOTE()
STRING FUNCTION
Fix:
=======
Added code in QUOTE string function to honor max_allowed_packet.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_strfunc.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7496b4f3cf4..ed02f668060 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, 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 @@ -3649,6 +3649,17 @@ String *Item_func_quote::val_str(String *str) *to= '\''; ret: + if (new_length > current_thd->variables.max_allowed_packet) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + current_thd->variables.max_allowed_packet); + null_value= true; + return NULL; + } + tmp_value.length(new_length); tmp_value.set_charset(collation.collation); null_value= 0; |