From bff25c29ef1557d9816dc213ceccb09d83ce1a9e Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sun, 7 Jul 2019 08:24:16 +0900 Subject: [PATCH] Fix to check the return value of strchr() in Pgversion(). Pointed out by Coverity. --- src/protocol/child.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/protocol/child.c b/src/protocol/child.c index 6d49c2c70..ecc797b88 100644 --- a/src/protocol/child.c +++ b/src/protocol/child.c @@ -2538,6 +2538,13 @@ Pgversion(POOL_CONNECTION_POOL * backend) * valid digit (in our case 'b')). So "12beta1" should be converted to 12. */ p = strchr(result, ' '); + if (p == NULL) + { + ereport(FATAL, + (errmsg("Pgversion: unable to find the first space in the version string: %s", result))); + return NULL; + } + p++; i = 0; while (i < VERSION_BUF_SIZE - 1 && p && *p != '.') -- 2.39.5