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:
@ -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);
|
||||
|
Reference in New Issue
Block a user