php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23198 segfault in _oci_open_session on oracle 9i
Submitted: 2003-04-14 05:12 UTC Modified: 2003-04-21 12:54 UTC
From: novicky at aarongroup dot cz Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.3.2RC1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: novicky at aarongroup dot cz
New email:
PHP Version: OS:

 

 [2003-04-14 05:12 UTC] novicky at aarongroup dot cz
Due to uninitialized values of charsetid in _oci_open_session() and charset in oci_do_connect() a segfault occures when charset paramter is ommited in OCILogon().

Following patch can fix it:

--- php-4.3.2RC1.orig/ext/oci8/oci8.c	2003-01-31 15:21:19.000000000 +0100
+++ php-4.3.2RC1/ext/oci8/oci8.c	2003-04-14 10:53:33.000000000 +0200
@@ -2154,7 +2154,7 @@
 	OCISvcCtx *svchp = 0;
 	char *hashed_details;
 #ifdef HAVE_OCI9
-	ub2 charsetid;
+	ub2 charsetid = 0;
 #endif
 	TSRMLS_FETCH();
 
@@ -2218,10 +2218,11 @@
 							OCI(pEnv),
 							charset));
 		
-		session->charsetId = charsetid;
 		oci_debug("oci_do_connect: using charset id=%d",charsetid);
 	}
 	
+	session->charsetId = charsetid;
+
 	/* create an environment using the character set id, Oracle 9i+ ONLY */
 	CALL_OCI(OCIEnvNlsCreate(
 				&session->pEnv,
@@ -2648,6 +2649,7 @@
 		username = Z_STRVAL_PP(userParam);
 		password = Z_STRVAL_PP(passParam);
 		dbname = Z_STRVAL_PP(dbParam);
+		charset = "";
 	} else if (zend_get_parameters_ex(2, &userParam, &passParam) == SUCCESS) {
 		convert_to_string_ex(userParam);
 		convert_to_string_ex(passParam);
@@ -2655,6 +2657,7 @@
 		username = Z_STRVAL_PP(userParam);
 		password = Z_STRVAL_PP(passParam);
 		dbname = "";
+		charset = "";
 	} else {
 		WRONG_PARAM_COUNT;
 	}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-21 12:54 UTC] sniper@php.net
Patch committed, thanks.

 [2003-04-21 12:54 UTC] sniper@php.net
Closed. :)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 02 18:01:26 2025 UTC