Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue 170: Fixed memory overwrite when converting Unicode to SQLWCHAR.

Many thanks to davidp.r...@gmail.com for finding this.
  • Loading branch information...
commit 8fa1cc4af672ffd73122a6b981b775542b7754d2 1 parent 7fdec2f
Michael Kleehammer authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/sqlwchar.cpp
View
2  src/sqlwchar.cpp
@@ -149,7 +149,7 @@ void SQLWChar::dump()
SQLWCHAR* SQLWCHAR_FromUnicode(const Py_UNICODE* pch, Py_ssize_t len)
{
- SQLWCHAR* p = (SQLWCHAR*)pyodbc_malloc(sizeof(SQLWCHAR) * len);
+ SQLWCHAR* p = (SQLWCHAR*)pyodbc_malloc(sizeof(SQLWCHAR) * (len + 1));
if (p != 0)
{
if (!sqlwchar_copy(p, pch, len))
Please sign in to comment.
Something went wrong with that request. Please try again.