mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Added sanity checks.
This commit is contained in:
parent
808cb3ad74
commit
ebf13bc940
1 changed files with 3 additions and 2 deletions
|
@ -111,6 +111,7 @@ EXEC SQL include sqlstype;
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
typedef char IFX[128];
|
typedef char IFX[128];
|
||||||
|
#define SAFE_STRING(s) ((s)?(s):"")
|
||||||
#define PHP_IFX_CHECK_CONNECTION(ifx) \
|
#define PHP_IFX_CHECK_CONNECTION(ifx) \
|
||||||
{ \
|
{ \
|
||||||
if (ifx_check() < 0) { \
|
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_length = sizeof("ifx___") - 1 + host_len + user_len + passwd_len;
|
||||||
hashed_details = (char *) emalloc(hashed_details_length+1);
|
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;
|
IFXG(sv_sqlcode) = 0;
|
||||||
|
@ -480,7 +481,7 @@ EXEC SQL END DECLARE SECTION;
|
||||||
/* create the link */
|
/* create the link */
|
||||||
ifx = (char *) malloc(sizeof(IFX));
|
ifx = (char *) malloc(sizeof(IFX));
|
||||||
IFXG(connectionid)++;
|
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;
|
EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue