Merge lp:~vlad-lesin/percona-server/5.1-bug1083377-gca into lp:percona-server/5.1

Proposed by Vlad Lesin on 2012-11-30
Status: Merged
Approved by: Stewart Smith on 2012-12-17
Approved revision: 504
Merged at revision: 506
Proposed branch: lp:~vlad-lesin/percona-server/5.1-bug1083377-gca
Merge into: lp:percona-server/5.1
Diff against target: 77 lines (+28/-4)
3 files modified
Percona-Server/mysql-test/r/information_schema.result (+4/-0)
Percona-Server/mysql-test/t/information_schema.test (+8/-0)
Percona-Server/sql/sql_acl.cc (+16/-4)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.1-bug1083377-gca
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve on 2012-12-17
Sergei Glushchenko (community) g2 2012-11-30 Approve on 2012-12-11
Review via email: mp+137233@code.launchpad.net
To post a comment you must log in.

Approve

review: Approve (g2)
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/mysql-test/r/information_schema.result'
2--- Percona-Server/mysql-test/r/information_schema.result 2012-08-15 14:05:13 +0000
3+++ Percona-Server/mysql-test/r/information_schema.result 2012-11-30 15:25:32 +0000
4@@ -1907,4 +1907,8 @@
5 length(CAST(b AS CHAR))
6 20
7 DROP TABLE ubig;
8+grant usage on *.* to mysqltest_1@localhost;
9+select 1 from information_schema.tables where table_schema=repeat('a', 2000);
10+1
11+drop user mysqltest_1@localhost;
12 End of 5.1 tests.
13
14=== modified file 'Percona-Server/mysql-test/t/information_schema.test'
15--- Percona-Server/mysql-test/t/information_schema.test 2010-06-23 16:25:31 +0000
16+++ Percona-Server/mysql-test/t/information_schema.test 2012-11-30 15:25:32 +0000
17@@ -1470,6 +1470,14 @@
18
19 DROP TABLE ubig;
20
21+#Bug 1083377
22+grant usage on *.* to mysqltest_1@localhost;
23+connect (con1, localhost, mysqltest_1,,);
24+connection con1;
25+select 1 from information_schema.tables where table_schema=repeat('a', 2000);
26+connection default;
27+disconnect con1;
28+drop user mysqltest_1@localhost;
29
30 --echo End of 5.1 tests.
31
32
33=== modified file 'Percona-Server/sql/sql_acl.cc'
34--- Percona-Server/sql/sql_acl.cc 2011-07-03 15:47:37 +0000
35+++ Percona-Server/sql/sql_acl.cc 2012-11-30 15:25:32 +0000
36@@ -1351,14 +1351,20 @@
37 acl_entry *entry;
38 DBUG_ENTER("acl_get");
39
40- VOID(pthread_mutex_lock(&acl_cache->lock));
41- end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db);
42+ tmp_db= strmov(strmov(key, ip ? ip : "") + 1, user) + 1;
43+ end= strnmov(tmp_db, db, key + sizeof(key) - tmp_db);
44+
45+ if (end >= key + sizeof(key)) // db name was truncated
46+ DBUG_RETURN(0); // no privileges for an invalid db name
47+
48 if (lower_case_table_names)
49 {
50 my_casedn_str(files_charset_info, tmp_db);
51 db=tmp_db;
52 }
53 key_length= (size_t) (end-key);
54+
55+ VOID(pthread_mutex_lock(&acl_cache->lock));
56 if (!db_is_pattern && (entry=(acl_entry*) acl_cache->search((uchar*) key,
57 key_length)))
58 {
59@@ -4327,11 +4333,17 @@
60 bool check_grant_db(THD *thd,const char *db)
61 {
62 Security_context *sctx= thd->security_ctx;
63- char helping [NAME_LEN+USERNAME_LENGTH+2];
64+ char helping [NAME_LEN+USERNAME_LENGTH+2], *end;
65 uint len;
66 bool error= TRUE;
67
68- len= (uint) (strmov(strmov(helping, sctx->priv_user) + 1, db) - helping) + 1;
69+ end= strmov(helping, sctx->priv_user) + 1;
70+ end= strnmov(end, db, helping + sizeof(helping) - end);
71+
72+ if (end >= helping + sizeof(helping)) // db name was truncated
73+ return 1; // no privileges for an invalid db name
74+
75+ len= (uint) (end - helping) + 1;
76
77 rw_rdlock(&LOCK_grant);
78

Subscribers

People subscribed via source and target branches