summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-01-29 19:33:38 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-01-29 19:33:38 +0000
commitebf13bc9405ee78ceb428fe7b9d47d29e68f44c4 (patch)
tree35edf28f62b3304a6983a2dfb78bec660f466481
parent808cb3ad74b1aefccad5dec606a50b2542295305 (diff)
downloadphp-git-ebf13bc9405ee78ceb428fe7b9d47d29e68f44c4.tar.gz
Added sanity checks.
-rw-r--r--ext/informix/ifx.ec5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec
index b5f8ae8b53..6189949c72 100644
--- a/ext/informix/ifx.ec
+++ b/ext/informix/ifx.ec
@@ -111,6 +111,7 @@ EXEC SQL include sqlstype;
#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 @@ EXEC SQL END DECLARE SECTION;
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 @@ EXEC SQL END DECLARE SECTION;
/* 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;