]> granicus.if.org Git - php/commitdiff
use spprintf instead (no need to estrdup afterwards).
authorMiRacLe.RPZ <miracle@rpz.name>
Sat, 17 Oct 2015 21:31:38 +0000 (00:31 +0300)
committerAnatol Belski <ab@php.net>
Sun, 18 Oct 2015 09:10:50 +0000 (11:10 +0200)
ext/pdo_dblib/dblib_stmt.c

index 5efded9deb62f5a0ba18c363033507ef40c60432..0b519995ca000ad6d70b02731fbc5fca9e5f1592 100644 (file)
@@ -205,15 +205,14 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
        struct pdo_column_data *col = &stmt->columns[colno];
 
        char *fname = (char*)dbcolname(H->link, colno+1);
-       char computed_buf[16];
+
        if (fname && *fname) {
                col->name = estrdup(fname);
+               col->namelen = strlen(col->name);
        } else {
-               snprintf(computed_buf,16,"computed%d", colno);
-               col->name = estrdup(computed_buf);
+               col->namelen = spprintf(&col->name, NULL, "computed%d", colno);
        }
        col->maxlen = dbcollen(H->link, colno+1);
-       col->namelen = strlen(col->name);
        col->param_type = PDO_PARAM_STR;
                
        return 1;