Skip to content

Commit

Permalink
- Fix MDEV-13239 Suppress the restriction about no blanks
Browse files Browse the repository at this point in the history
around , and = in the OPTION_LIST.
  modified:   storage/connect/ha_connect.cc
  • Loading branch information
Buggynours committed Jul 4, 2017
1 parent 7542aff commit a9d3201
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1036,26 +1036,43 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
return (char*)def;

char key[16], val[256];
char *pk, *pv, *pn;
char *pv, *pn, *pk= (char*)oplist;
PCSZ opval= def;
int n;

for (pk= (char*)oplist; pk; pk= ++pn) {
while (*pk == ' ')
pk++;

for (; pk; pk= pn) {
pn= strchr(pk, ',');
pv= strchr(pk, '=');

if (pv && (!pn || pv < pn)) {
n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
memcpy(key, pk, n);

while (n && key[n - 1] == ' ')
n--;

key[n]= 0;
pv++;

while(*(++pv) == ' ') ;

n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
memcpy(val, pv, n);
val[n]= 0;

while (n && val[n - 1] == ' ')
n--;

val[n]= 0;
} else {
n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
memcpy(key, pk, n);
key[n]= 0;

while (n && key[n - 1] == ' ')
n--;

key[n]= 0;
val[0]= 0;
} // endif pv

Expand All @@ -1065,6 +1082,7 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
} else if (!pn)
break;

while (*(++pn) == ' ') ;
} // endfor pk

return opval;
Expand Down

0 comments on commit a9d3201

Please sign in to comment.