From 9fcfc18ca9a38ed318f8a7026c0eda27aed79f28 Mon Sep 17 00:00:00 2001 From: Adam Baratz Date: Fri, 1 Apr 2016 11:23:35 -0400 Subject: Fix #71943: dblib_handle_quoter needs to allocate an extra byte --- ext/pdo_dblib/dblib_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/pdo_dblib/dblib_driver.c') diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index dcbaf55a3f..9937466561 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -170,7 +170,7 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unqu * */ *quotedlen = (unquotedlen * 2) + 2; /* 2 chars per byte +2 for "0x" prefix */ - q = *quoted = emalloc(*quotedlen); + q = *quoted = emalloc(*quotedlen+1); /* Add byte for terminal null */ *q++ = '0'; *q++ = 'x'; @@ -181,7 +181,7 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unqu } else { /* Alpha/Numeric Quoting */ *quotedlen += 2; /* +2 for opening, closing quotes */ - q = *quoted = emalloc(*quotedlen); + q = *quoted = emalloc(*quotedlen+1); /* Add byte for terminal null */ *q++ = '\''; for (i=0;i