summaryrefslogtreecommitdiff
path: root/ext/mysql/libmysql/mf_pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysql/libmysql/mf_pack.c')
-rw-r--r--ext/mysql/libmysql/mf_pack.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/mysql/libmysql/mf_pack.c b/ext/mysql/libmysql/mf_pack.c
index a6ab070870..b6b079bdac 100644
--- a/ext/mysql/libmysql/mf_pack.c
+++ b/ext/mysql/libmysql/mf_pack.c
@@ -222,11 +222,16 @@ void symdirget(char *dir)
*pos++=temp; *pos=0; /* Restore old filename */
if (fp)
{
- if (fgets(buff, sizeof(buff), fp))
+ if (fgets(buff, sizeof(buff)-1, fp))
{
for (pos=strend(buff);
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
pos --);
+
+ /* Ensure that the symlink ends with the directory symbol */
+ if (pos == buff || pos[-1] != FN_LIBCHAR)
+ *pos++=FN_LIBCHAR;
+
strmake(dir,buff, (uint) (pos-buff));
}
my_fclose(fp,MYF(0));