Skip to content

Commit 0c1e2e4

Browse files
committed
set client_encoding to <nothing> crashes backend.
1 parent 507a0a2 commit 0c1e2e4

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/backend/utils/mb/common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This file contains some public functions
33
* usable for both the backend and the frontend.
44
* Tatsuo Ishii
5-
* $Id: common.c,v 1.3 1998/10/06 03:02:21 momjian Exp $ */
5+
* $Id: common.c,v 1.4 1999/05/13 10:28:25 ishii Exp $ */
66

77
#include <stdlib.h>
88

@@ -28,6 +28,10 @@ pg_char_to_encoding(const char *s)
2828
{
2929
pg_encoding_conv_tbl *p = pg_conv_tbl;
3030

31+
if (!s) {
32+
return (-1);
33+
}
34+
3135
for (; p->encoding >= 0; p++)
3236
{
3337
if (!strcasecmp(s, p->name))

src/backend/utils/mb/variable.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This file contains some public functions
33
* related to show/set/reset variable commands.
44
* Tatsuo Ishii
5-
* $Id: variable.c,v 1.2 1998/09/01 04:33:24 momjian Exp $
5+
* $Id: variable.c,v 1.3 1999/05/13 10:28:26 ishii Exp $
66
*/
77

88
#include "mb/pg_wchar.h"
@@ -13,8 +13,13 @@ parse_client_encoding(const char *value)
1313
int encoding;
1414

1515
encoding = pg_valid_client_encoding(value);
16-
if (encoding < 0)
17-
elog(ERROR, "Client encoding %s is not supported", value);
16+
if (encoding < 0) {
17+
if (value) {
18+
elog(ERROR, "Client encoding %s is not supported", value);
19+
} else {
20+
elog(ERROR, "No client encoding is specified");
21+
}
22+
}
1823
else
1924
{
2025
if (pg_set_client_encoding(encoding))

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