From 52f0c9b2275d9af4a81d7d752535cf0cdb043fcd Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 2 Dec 2025 21:16:19 +0000 Subject: Strip all newline characters from the PostgreSQL error message. --- src/modules/extra/m_pgsql.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modules/extra/m_pgsql.cpp') diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 70846d90e..309bcc9de 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -417,7 +417,10 @@ restart: case PGRES_BAD_RESPONSE: case PGRES_FATAL_ERROR: { - SQL::Error err(SQL::QREPLY_FAIL, PQresultErrorMessage(result)); + std::string errmsg = PQresultErrorMessage(result); + for (size_t pos = 0; ((pos = errmsg.find_first_of("\r\n", pos)) != std::string::npos); ) + errmsg[pos] = ' '; + SQL::Error err(SQL::QREPLY_FAIL, errmsg); qinprog.c->OnError(err); break; } -- cgit v1.3.1-10-gc9f91