summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-10-12 13:26:49 -0700
committerunknown <jimw@mysql.com>2005-10-12 13:26:49 -0700
commit9a3bce50ae0e9e334f952bcb67c8c5575c39a0bd (patch)
tree811ffccd8ff30362ac2789d29e0d5b461d921482
parent61dfc3347f013eadb46a5035cbf0479bcacc8f22 (diff)
parent041123bade5372483d387a724d22a8f7e06d0645 (diff)
downloadmariadb-git-9a3bce50ae0e9e334f952bcb67c8c5575c39a0bd.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.1-13619
into mysql.com:/home/jimw/my/mysql-4.1-clean
-rw-r--r--mysql-test/r/func_crypt.result3
-rw-r--r--mysql-test/t/func_crypt.test6
-rw-r--r--sql/item_strfunc.cc8
3 files changed, 16 insertions, 1 deletions
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 2ee3e770a2e..afdec0f4d06 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -92,3 +92,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
+select encrypt('1234','_.');
+encrypt('1234','_.')
+#
diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test
index 5e0283feb28..cc3cdb9564d 100644
--- a/mysql-test/t/func_crypt.test
+++ b/mysql-test/t/func_crypt.test
@@ -49,4 +49,10 @@ select old_password(' i d k f a ');
explain extended select password('idkfa '), old_password('idkfa');
+#
+# Bug #13619: Crash on FreeBSD with salt like '_.'
+#
+--replace_column 1 #
+select encrypt('1234','_.');
+
# End of 4.1 tests
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 6962ba7c4ac..6ca6ce62c54 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1497,7 +1497,13 @@ String *Item_func_encrypt::val_str(String *str)
salt_ptr= salt_str->c_ptr();
}
pthread_mutex_lock(&LOCK_crypt);
- char *tmp=crypt(res->c_ptr(),salt_ptr);
+ char *tmp= crypt(res->c_ptr(),salt_ptr);
+ if (!tmp)
+ {
+ pthread_mutex_unlock(&LOCK_crypt);
+ null_value= 1;
+ return 0;
+ }
str->set(tmp,(uint) strlen(tmp),res->charset());
str->copy();
pthread_mutex_unlock(&LOCK_crypt);