iliaa Wed Jan 29 14:33:38 2003 EDT
Modified files:
/php4/ext/informix ifx.ec
Log:
Added sanity checks.
Index: php4/ext/informix/ifx.ec
diff -u php4/ext/informix/ifx.ec:1.76 php4/ext/informix/ifx.ec:1.77
--- php4/ext/informix/ifx.ec:1.76 Sat Jan 25 13:55:05 2003
+++ php4/ext/informix/ifx.ec Wed Jan 29 14:33:37 2003
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ifx.ec,v 1.76 2003/01/25 18:55:05 iliaa Exp $ */
+/* $Id: ifx.ec,v 1.77 2003/01/29 19:33:37 iliaa Exp $ */
/* -------------------------------------------------------------------
* if you want a function reference : "grep '^\*\*' ifx.ec" will give
@@ -111,6 +111,7 @@
#include <errno.h>
typedef char IFX[128];
+#define SAFE_STRING(s) ((s)?(s):"")
#define PHP_IFX_CHECK_CONNECTION(ifx) \
{ \
if (ifx_check() < 0) { \
@@ -451,7 +452,7 @@
hashed_details_length = sizeof("ifx___") - 1 + host_len + user_len +
passwd_len;
hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"ifx_%s_%s_%s", host, user, passwd);
+ sprintf(hashed_details,"ifx_%s_%s_%s", SAFE_STRING(host),
+SAFE_STRING(user), SAFE_STRING(passwd));
}
IFXG(sv_sqlcode) = 0;
@@ -480,7 +481,7 @@
/* create the link */
ifx = (char *) malloc(sizeof(IFX));
IFXG(connectionid)++;
- sprintf(ifx,"%s%x", user, IFXG(connectionid));
+ sprintf(ifx,"%s%x", SAFE_STRING(user), IFXG(connectionid));
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd
WITH CONCURRENT TRANSACTION;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php