abies Mon Jan 12 14:47:29 2004 EDT
Modified files:
/php-src/ext/interbase interbase.c
Log:
Added sanity check on ibase_[p]connect() dialect argument (fixes obscure
unregistered bug)
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.191 php-src/ext/interbase/interbase.c:1.192
--- php-src/ext/interbase/interbase.c:1.191 Thu Jan 8 03:15:50 2004
+++ php-src/ext/interbase/interbase.c Mon Jan 12 14:47:28 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.191 2004/01/08 08:15:50 andi Exp $ */
+/* $Id: interbase.c,v 1.192 2004/01/12 19:47:28 abies Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -26,7 +26,7 @@
#include "php.h"
-#define FILE_REVISION "$Revision: 1.191 $"
+#define FILE_REVISION "$Revision: 1.192 $"
#if HAVE_IBASE
@@ -940,7 +940,10 @@
ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
ib_link->handle = db_handle;
- ib_link->dialect = (ib_dialect ? (unsigned short)
strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
+ if (ib_dialect) {
+ unsigned short d = (unsigned short)strtoul(ib_dialect,
NULL, 10);
+ ib_link->dialect = (d ? d : SQL_DIALECT_CURRENT);
+ }
ib_link->tr_list = NULL;
/* hash it up */
@@ -1002,7 +1005,10 @@
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
ib_link->handle = db_handle;
- ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect,
NULL, 10) : SQL_DIALECT_CURRENT);
+ if (ib_dialect) {
+ unsigned short d = (unsigned short)strtoul(ib_dialect, NULL,
10);
+ ib_link->dialect = (d ? d : SQL_DIALECT_CURRENT);
+ }
ib_link->tr_list = NULL;
ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php