summaryrefslogtreecommitdiff
path: root/sql/sql_priv.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-04-19 22:27:02 +0200
committerSergei Golubchik <serg@mariadb.org>2018-04-19 22:31:26 +0200
commit1a019d08012db7b3fa6a42d39342792c3418e75b (patch)
treec116066b995f1c7a2d8c11e72aa9fa547a20407b /sql/sql_priv.h
parent5e61e1716e763315009318081fba5994b8910242 (diff)
parentc0b4d74b52e7eec9b13af732193f7f8d7abe05de (diff)
downloadmariadb-git-1a019d08012db7b3fa6a42d39342792c3418e75b.tar.gz
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/sql_priv.h')
-rw-r--r--sql/sql_priv.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index b5589cb4b22..3195c5bb4a4 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, Monty Program Ab.
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2018, Monty Program Ab.
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
@@ -193,6 +193,11 @@ template <class T> T available_buffer(const char* buf_start,
const char* buf_current,
T buf_len)
{
+ /* Sanity check */
+ if (buf_current < buf_start ||
+ buf_len < static_cast<T>(buf_current - buf_start))
+ return static_cast<T>(0);
+
return buf_len - (buf_current - buf_start);
}