From acb2368976687d68381ae391ac3d917ae8fc2dd0 Mon Sep 17 00:00:00 2001 From: "MiRacLe.RPZ" Date: Fri, 3 Jul 2015 10:28:06 +0300 Subject: [PATCH] Segmentation fault on pdo_dblib::nextRowset (bug #69757) --- ext/pdo_dblib/dblib_stmt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index 263ae6dcb8..9f47f0f7ed 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -203,8 +203,15 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) } struct pdo_column_data *col = &stmt->columns[colno]; - - col->name = (char*)dbcolname(H->link, colno+1); + + char *fname = (char*)dbcolname(H->link, colno+1); + char computed_buf[16]; + if (*fname) { + col->name = estrdup(fname); + } else { + snprintf(computed_buf,16,"computed%d", colno); + col->name = estrdup(computed_buf); + } col->maxlen = dbcollen(H->link, colno+1); col->namelen = strlen(col->name); col->param_type = PDO_PARAM_STR; -- 2.40.0