summaryrefslogtreecommitdiff
path: root/mysys/my_getwd.c
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-09 02:03:35 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-09 02:03:35 +0400
commit5ef2bdea81a68a5440235bb5c841fff5dcc2b2c7 (patch)
treefaf6e2793eae5ff3a0ec48cebf47e8045db0a6ff /mysys/my_getwd.c
parente94c1ab135e035dea4c2db9508d2d635b70bcf80 (diff)
parent721ec081901b661b9338a47b3144c6c41829165a (diff)
downloadmariadb-git-5ef2bdea81a68a5440235bb5c841fff5dcc2b2c7.tar.gz
Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts: Text conflict in mysql-test/r/grant.result Text conflict in mysql-test/t/grant.test Text conflict in mysys/mf_loadpath.c Text conflict in sql/slave.cc Text conflict in sql/sql_priv.h
Diffstat (limited to 'mysys/my_getwd.c')
-rw-r--r--mysys/my_getwd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index 6ef8d571492..75bb6e20911 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -50,11 +50,16 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
DBUG_PRINT("my",("buf: 0x%lx size: %u MyFlags %d",
(long) buf, (uint) size, MyFlags));
+ if (size < 1)
+ return(-1);
+
if (curr_dir[0]) /* Current pos is saved here */
(void) strmake(buf,&curr_dir[0],size-1);
else
{
#if defined(HAVE_GETCWD)
+ if (size < 2)
+ return(-1);
if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME)
{
my_errno=errno;
@@ -68,6 +73,8 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
strmake(buf,pathname,size-1);
}
#elif defined(VMS)
+ if (size < 2)
+ return(-1);
if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
{
my_errno=errno;