Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita772bdc

Browse files
knizhnikkelvich
authored andcommitted
Check validness of node-id in config
1 parent6f1906b commita772bdc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎multimaster.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ void MtmUpdateNodeConnStr(int nodeId, char const* connStr)
11951195
elog(ERROR,"Host not specified in connection string: '%s'",connStr);
11961196
}
11971197
host+=5;
1198-
for (end=host;*end!=' '&&*end!=','&&*end!='\0';end++);
1198+
for (end=host;*end!=' '&&*end!='\0';end++);
11991199
hostLen=end-host;
12001200
if (hostLen >=MULTIMASTER_MAX_HOST_NAME_SIZE) {
12011201
elog(ERROR,"Too long (%d) host name '%.*s' for node %d, limit is %d",
@@ -1229,7 +1229,7 @@ static void MtmSplitConnStrs(void)
12291229
elog(ERROR,"Database not specified in connection string: '%s'",connStr);
12301230
}
12311231
dbName+=7;
1232-
for (end=dbName;*end!=' '&&*end!=','&&*end!='\0';end++);
1232+
for (end=dbName;*end!=' '&&*end!='\0';end++);
12331233
len=end-dbName;
12341234
MtmDatabaseName= (char*)malloc(len+1);
12351235
memcpy(MtmDatabaseName,dbName,len);
@@ -1242,6 +1242,9 @@ static void MtmSplitConnStrs(void)
12421242
elog(ERROR,"Multimaster should have at least two nodes");
12431243
}
12441244
MtmNodes=i;
1245+
if (MtmNodeId>MtmNodes) {
1246+
elog(ERROR,"Invalid node id %d for specified nubmer of nodes %d",MtmNodeId,MtmNodes);
1247+
}
12451248
}
12461249

12471250
void
@@ -1353,7 +1356,7 @@ _PG_init(void)
13531356
"Multimaster node ID",
13541357
NULL,
13551358
&MtmNodeId,
1356-
1,
1359+
INT_MAX,
13571360
1,
13581361
INT_MAX,
13591362
PGC_BACKEND,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp