Skip to content

Commit f7ca813

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 7b3e68f + 279589c commit f7ca813

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ static bool pgsql_handle_in_transaction(pdo_dbh_t *dbh);
3939

4040
static char * _pdo_pgsql_trim_message(const char *message, int persistent)
4141
{
42-
size_t i = strlen(message)-1;
42+
size_t i = strlen(message);
4343
char *tmp;
44+
if (UNEXPECTED(i == 0)) {
45+
tmp = pemalloc(1, persistent);
46+
tmp[0] = '\0';
47+
return tmp;
48+
}
49+
--i;
4450

4551
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
4652
--i;

0 commit comments

Comments
 (0)