php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61212
Patch Segfault_fix_for_pdo_odbc revision 2012-02-29 19:21 UTC by anilvarghese25 at gmail dot com

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;
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 02:02:10 2014 UTC