Fixed segmentation fault at parsing config file.
authorBo Peng <pengbo@sraoss.co.jp>
Fri, 28 Jun 2024 10:42:58 +0000 (19:42 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Fri, 28 Jun 2024 10:42:58 +0000 (19:42 +0900)
This commit fixed a segmentation fault that occurs when parsing pgpool.conf
if the setting value was not enclosed in single quotes.

The patch is created by Carlos Chapi, reviewed and modified by Tatsuo Ishii.

src/config/pool_config.l

index 2eef2ed116d43bb83ae57bac385398672aae7fd4..b681e8a38661474782f829e0b5e7a285338a7899 100644 (file)
@@ -335,7 +335,7 @@ ParseConfigFile(const char *config_file, const char *calling_file,
        FILE *fd;
        YY_BUFFER_STATE lex_buffer;
        int token;
-       char *key = NULL;
+       char *key;
        char *val;
        ConfigVariable *item;
        char buf[POOLMAXPATHLEN + 1];
@@ -394,6 +394,8 @@ ParseConfigFile(const char *config_file, const char *calling_file,
 
        for(;;)
        {
+               key = NULL;
+
                token = yylex();
 
                if (token == 0)