We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7b3e68f + 279589c commit f7ca813Copy full SHA for f7ca813
ext/pdo_pgsql/pgsql_driver.c
@@ -39,8 +39,14 @@ static bool pgsql_handle_in_transaction(pdo_dbh_t *dbh);
39
40
static char * _pdo_pgsql_trim_message(const char *message, int persistent)
41
{
42
- size_t i = strlen(message)-1;
+ size_t i = strlen(message);
43
char *tmp;
44
+ if (UNEXPECTED(i == 0)) {
45
+ tmp = pemalloc(1, persistent);
46
+ tmp[0] = '\0';
47
+ return tmp;
48
+ }
49
+ --i;
50
51
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
52
--i;
0 commit comments