aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/scripts/common.c')
-rw-r--r--src/bin/scripts/common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c
index 7f4b635571d..bb52e6b9ffe 100644
--- a/src/bin/scripts/common.c
+++ b/src/bin/scripts/common.c
@@ -23,6 +23,8 @@
#include "fe_utils/string_utils.h"
+#define PQmblenBounded(s, e) strnlen(s, PQmblen(s, e))
+
static PGcancel *volatile cancelConn = NULL;
bool CancelRequested = false;
@@ -300,7 +302,7 @@ splitTableColumnsSpec(const char *spec, int encoding,
cp++;
}
else
- cp += PQmblen(cp, encoding);
+ cp += PQmblenBounded(cp, encoding);
}
*table = pg_strdup(spec);
(*table)[cp - spec] = '\0'; /* no strndup */