summaryrefslogtreecommitdiff
path: root/mysys/mf_pack.c
diff options
context:
space:
mode:
authorChad MILLER <chad@mysql.com>2008-08-18 13:06:27 -0400
committerChad MILLER <chad@mysql.com>2008-08-18 13:06:27 -0400
commitace51b79f176cdcfc1070ec4a7924b7a70a0b9bf (patch)
tree974ea42d7a283296a0e9adf806dd51492c0a99e5 /mysys/mf_pack.c
parent21598ea0e6c9495aba817b0101488549e4e78bd3 (diff)
downloadmariadb-git-ace51b79f176cdcfc1070ec4a7924b7a70a0b9bf.tar.gz
Bug#30394: Empty HOME environment variable causes several utilities to crash
Tilde expansion could fail when it was to expand to an empty string (such as when HOME is set to an empty string), especially on systems where size_t is unsigned.
Diffstat (limited to 'mysys/mf_pack.c')
-rw-r--r--mysys/mf_pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 915c11ec51d..0157a65311a 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -343,7 +343,7 @@ uint unpack_dirname(my_string to, const char *from)
length-=(uint) (suffix-buff)-1;
if (length+(h_length= (uint) strlen(tilde_expansion)) <= FN_REFLEN)
{
- if (tilde_expansion[h_length-1] == FN_LIBCHAR)
+ if ((h_length > 0) && (tilde_expansion[h_length-1] == FN_LIBCHAR))
h_length--;
if (buff+h_length < suffix)
bmove(buff+h_length,suffix,length);