Use constant sized arrays for some service strings

The `user`, `password`, `version_string` and `weightby` values should be
allocated as a part of the service structure. This allows them to be
modified at runtime without having to worry about memory allocation
problems.

Although this removes the problem of reallocation, it still does not make
the updating of the strings thread-safe. This can cause invalid values to
be read from the service strings.
This commit is contained in:
Markus Mäkelä
2017-04-24 11:31:25 +03:00
parent b434c94563
commit e62be5034a
10 changed files with 67 additions and 85 deletions

View File

@ -248,7 +248,7 @@ int MySQLSendHandshake(DCB* dcb)
GWBUF *buf;
/* get the version string from service property if available*/
if (dcb->service->version_string != NULL)
if (dcb->service->version_string[0])
{
version_string = dcb->service->version_string;
len_version_string = strlen(version_string);