Patch Segfault_fix_for_pdo_odbc for PDO related Bug #61212
Patch version 2012-02-29 19:21 UTC
Return to Bug #61212 |
Download this patch
Patch Revisions:
Developer: anilvarghese25@gmail.com
Index: odbc_stmt.c
===================================================================
--- odbc_stmt.c (revision 323676)
+++ odbc_stmt.c (working copy)
@@ -641,8 +641,14 @@
}
buf = emalloc(alloced);
- memcpy(buf, C->data, 256);
- used = 255; /* not 256; the driver NUL terminated the buffer */
+
+ if (C->fetched_len > 256) {
+ memcpy(buf, C->data, 256);
+ used = 255; /* not 256; the driver NUL terminated the buffer */
+ } else {
+ memcpy(buf, C->data, C->fetched_len);
+ used = C->fetched_len - 1;
+ }
do {
C->fetched_len = 0;
|