Skip to content

Commit 27eeca5

Browse files
committed
For GUC values, check for partial string matches on 'on' and 'off', but
require at least two characters for uniqueness. This now matches the behavior of other boolean strings we support, per report from Gurjeet Singh.
1 parent a78fcfb commit 27eeca5

File tree

1 file changed

+4
-3
lines changed
  • src/backend/utils/misc

1 file changed

+4
-3
lines changed

src/backend/utils/misc/guc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.362 2006/12/13 05:54:48 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.363 2006/12/23 00:52:40 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -3575,12 +3575,13 @@ parse_bool(const char *value, bool *result)
35753575
*result = false;
35763576
}
35773577

3578-
else if (pg_strcasecmp(value, "on") == 0)
3578+
/* 'o' is not unique enough */
3579+
else if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
35793580
{
35803581
if (result)
35813582
*result = true;
35823583
}
3583-
else if (pg_strcasecmp(value, "off") == 0)
3584+
else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
35843585
{
35853586
if (result)
35863587
*result = false;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy