diff --git a/bin/pgut/pgut.c b/bin/pgut/pgut.c index 66db463..3a3f5ef 100644 --- a/bin/pgut/pgut.c +++ b/bin/pgut/pgut.c @@ -434,7 +434,26 @@ simple_string_list_size(SimpleStringList list) static char * prompt_for_password(void) { - return simple_prompt("Password: ", 100, false); + char *buf; +#define BUFSIZE 100 + +#if PG_VERSION_NUM < 100000 + buf = simple_prompt("Password: ", BUFSIZE, false); +#else + buf = (char *)malloc(BUFSIZE); + if (buf != NULL) + simple_prompt("Password: ", buf, BUFSIZE, false); +#endif + + if (buf == NULL) + ereport(FATAL, + (errcode_errno(), + errmsg("could not allocate memory (" UINT64_FORMAT " bytes): ", + (unsigned long) BUFSIZE))); + + return buf; + +#undef BUFSIZE }