Re: Postmaster crashes on SIGHUP when oauth_validator_libraries holds only whitespace - Mailing list pgsql-bugs

From Daniel Gustafsson
Subject Re: Postmaster crashes on SIGHUP when oauth_validator_libraries holds only whitespace
Date
Msg-id 75204002-3933-4034-8959-DADD0593A800@yesql.se
Whole thread
In response to Postmaster crashes on SIGHUP when oauth_validator_libraries holds only whitespace  (Grigorev Jurij <ju.grigorev@ftdata.ru>)
Responses Re: Postmaster crashes on SIGHUP when oauth_validator_libraries holds only whitespace
Re: Postmaster crashes on SIGHUP when oauth_validator_libraries holds only whitespace
List pgsql-bugs
-    if (oauth_validator_libraries_string[0] == '\0')
-    {
-        ereport(elevel,
-                errcode(ERRCODE_CONFIG_FILE_ERROR),
-                errmsg("parameter \"%s\" must be set for authentication method \"%s\"",
-                       "oauth_validator_libraries", "oauth"),
-                errcontext("line %d of configuration file \"%s\"",
-                           line_num, file_name));
-        *err_msg = psprintf("parameter \"%s\" must be set for authentication method \"%s\"",
-                            "oauth_validator_libraries", "oauth");
-        return false;
-    }
-
     /* SplitDirectoriesString needs a modifiable copy */
     rawstring = pstrdup(oauth_validator_libraries_string);

pstrdup calls strlen which segfault on NULL.  oauth_validator_libraries_string
has a default value of "" so it cannot be set to NULL by user action, but the
global variable backing the GUC is initialized as NULL so I wonder if it's
worth adding defensive programming like the below, or perhaps an Assert?

        /* SplitDirectoriesString needs a modifiable copy */
-       rawstring = pstrdup(oauth_validator_libraries_string);
+       rawstring = pstrdup(oauth_validator_libraries_string ?
+                                               oauth_validator_libraries_string : "");

--
Daniel Gustafsson




pgsql-bugs by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: BUG #19633: Unexpected results of IN (subquery) with a non-deterministic collation
Next
From: Alexander Korotkov
Date:
Subject: Re: BUG #19633: Unexpected results of IN (subquery) with a non-deterministic collation