cvs: php-src /ext/pdo_firebird firebird_driver.c

From: Date: Thu, 18 Jan 2007 15:54:45 +0000
Subject: cvs: php-src /ext/pdo_firebird firebird_driver.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42778@lists.php.net to get a copy of this message
tony2001 Thu Jan 18 15:54:45 2007 UTC Modified files: /php-src/ext/pdo_firebird firebird_driver.c Log: use snprintf() http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_driver.c?r1=1.21&r2=1.22&diff_format=u Index: php-src/ext/pdo_firebird/firebird_driver.c diff -u php-src/ext/pdo_firebird/firebird_driver.c:1.21 php-src/ext/pdo_firebird/firebird_driver.c:1.22 --- php-src/ext/pdo_firebird/firebird_driver.c:1.21 Mon Jan 1 09:29:27 2007 +++ php-src/ext/pdo_firebird/firebird_driver.c Thu Jan 18 15:54:45 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: firebird_driver.c,v 1.21 2007/01/01 09:29:27 sebastian Exp $ */ +/* $Id: firebird_driver.c,v 1.22 2007/01/18 15:54:45 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -602,6 +602,8 @@ { "role", NULL, 0 } }; int i, ret = 0; + short buf_len = 256, dpb_len; + pdo_firebird_db_handle *H = dbh->driver_data = pecalloc(1,sizeof(*H),dbh->is_persistent); php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 3); @@ -616,9 +618,11 @@ /* loop through all the provided arguments and set dpb fields accordingly */ for (i = 0; i < sizeof(dpb_flags); ++i) { - if (dpb_values[i]) { - dpb += sprintf(dpb, "%c%c%s", dpb_flags[i], (unsigned char)strlen(dpb_values[i]), + if (dpb_values[i] && buf_len > 0) { + dpb_len = snprintf(dpb, buf_len, "%c%c%s", dpb_flags[i], (unsigned char)strlen(dpb_values[i]), dpb_values[i]); + dpb += dpb_len; + buf_len -= dpb_len; } }

« previous php.cvs (#42778) next »