From 50ea26760da4e0fcf4980e739e1d0ed520de8d59 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sat, 24 Feb 2007 02:17:47 +0000 Subject: - Avoid sprintf, even when checked copy'n'paste or changes lead to errors --- ext/sybase_ct/php_sybase_ct.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ext/sybase_ct/php_sybase_ct.c') diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 8cd752dded..10358c96c4 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -996,8 +996,7 @@ PHP_FUNCTION(sybase_select_db) ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink); convert_to_string_ex(db); - cmdbuf = (char *) emalloc(sizeof("use ")+Z_STRLEN_PP(db)+1); - sprintf(cmdbuf, "use %s", Z_STRVAL_PP(db)); /* SAFE */ + spprintf(&cmdbuf, 0, "use %s", Z_STRVAL_PP(db)); /* SAFE */ if (exec_cmd(sybase_ptr, cmdbuf)==FAILURE) { efree(cmdbuf); @@ -2115,16 +2114,16 @@ PHP_MINFO_FUNCTION(sybase) php_info_print_table_start(); php_info_print_table_header(2, "Sybase_CT Support", "enabled" ); - sprintf(buf, "%ld", SybCtG(num_persistent)); + snprintf(buf, sizeof(buf), "%ld", SybCtG(num_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - sprintf(buf, "%ld", SybCtG(num_links)); + snprintf(buf, sizeof(buf), "%ld", SybCtG(num_links)); php_info_print_table_row(2, "Active Links", buf); - sprintf(buf, "%ld", SybCtG(min_server_severity)); + snprintf(buf, sizeof(buf), "%ld", SybCtG(min_server_severity)); php_info_print_table_row(2, "Min server severity", buf); - sprintf(buf, "%ld", SybCtG(min_client_severity)); + snprintf(buf, sizeof(buf), "%ld", SybCtG(min_client_severity)); php_info_print_table_row(2, "Min client severity", buf); php_info_print_table_row(2, "Application Name", SybCtG(appname)); - sprintf(buf, "%ld", SybCtG(deadlock_retry_count)); + snprintf(buf, sizeof(buf), "%ld", SybCtG(deadlock_retry_count)); php_info_print_table_row(2, "Deadlock retry count", buf); php_info_print_table_end(); -- cgit v1.2.1