From 968fbc6acf0bc27be17c0209be7f966e89a55943 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 22 Mar 2015 18:20:59 -0700 Subject: [PATCH] Bacport fix bug #68741 - Null pointer dereference --- NEWS | 3 +++ ext/pgsql/pgsql.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 16ce7bf..eb55777 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -6484,6 +6484,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c /* schame.table should be "schame"."table" */ table_copy = estrdup(table); token = php_strtok_r(table_copy, ".", &tmp); + if (token == NULL) { + token = table; + } len = strlen(token); if (_php_pgsql_detect_identifier_escape(token, len) == SUCCESS) { smart_str_appendl(querystr, token, len); -- 2.1.4