]> granicus.if.org Git - php/commitdiff
Fix bug #67134 (PDO_DBLIB Missing null string terminator)
authorStanley Sufficool <ssufficool@php.net>
Tue, 21 Oct 2014 04:44:47 +0000 (21:44 -0700)
committerStanley Sufficool <ssufficool@php.net>
Tue, 21 Oct 2014 04:44:47 +0000 (21:44 -0700)
ext/pdo_dblib/dblib_stmt.c

index a29405b24e81239a4c7af8eb5f20cc0a0cacd882..5909f6407fbea49af4b52079e8368cba6d4b6265 100644 (file)
@@ -255,12 +255,11 @@ static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
                        break;
                }
                case SQLUNIQUE: {
-                       *len = 36+1;
+                       *len = 37;
                        tmp_ptr = emalloc(*len + 1);
-
-                       /* uniqueidentifier is a 16-byte binary number, convert to 32 char hex string */
                        *len = dbconvert(NULL, SQLUNIQUE, *ptr, *len, SQLCHAR, tmp_ptr, *len);
                        php_strtoupper(tmp_ptr, *len);
+                       tmp_ptr[36] = '\0';
                        *ptr = tmp_ptr;
                        break;
                }