php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28081 mssql_connect segfaults with wrong parameters
Submitted: 2004-04-20 19:41 UTC Modified: 2005-02-07 22:14 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: sean@php.net Assigned: fmk (profile)
Status: Not a bug Package: MSSQL related
PHP Version: 4CVS-2004-04-20 (stable) 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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sean@php.net
New email:
PHP Version: OS:

 

 [2004-04-20 19:41 UTC] sean@php.net
Description:
------------
Similar to bug #11490.

mssql_connect (and mssql_pconnect) segfault when called witout the user/password parameters.

Using PHP CVS Snap from today, FreeTDS v 0.53-7 (Debian Unstable).

Reproduce code:
---------------
echo "Connected: ". ( mssql_pconnect("some_instance") ? 'yes' : 'no' ) ."\n";

Expected result:
----------------
No Segfault, uses the interfaces/freetds.conf file for user/pass info.

Actual result:
--------------
Warning: mssql_pconnect(): Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in mssql_test2.php on line 3
Segmentation fault


(gdb) bt
#0  0x402785f3 in tds_reset_msg_info () from /usr/lib/libsybdb.so.1
#1  0x4027470d in dblib_handle_err_message () from /usr/lib/libsybdb.so.1
#2  0x4027852e in tds_process_column_row () from /usr/lib/libsybdb.so.1
#3  0x4027697f in tds_process_default_tokens () from /usr/lib/libsybdb.so.1
#4  0x40276b5d in tds_process_login_tokens () from /usr/lib/libsybdb.so.1
#5  0x40279c6c in tds_connect () from /usr/lib/libsybdb.so.1
#6  0x40271e33 in tdsdbopen () from /usr/lib/libsybdb.so.1
#7  0x40264e9f in php_mssql_do_connect (ht=1, return_value=0x8196db4, this_ptr=0x0, return_value_used=1, persistent=1)
    at /home/sean/php4-STABLE-200404122030/ext/mssql/php_mssql.c:501
#8  0x40265491 in zif_mssql_pconnect (ht=1, return_value=0x8196db4, this_ptr=0x0, return_value_used=1)
    at /home/sean/php4-STABLE-200404122030/ext/mssql/php_mssql.c:684
#9  0x0811f1fa in execute (op_array=0x8199c44) at /home/sean/php/stable/Zend/zend_execute.c:1637
#10 0x0810fc28 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/sean/php/stable/Zend/zend.c:886
#11 0x080ed383 in php_execute_script (primary_file=0xbffffca8) at /home/sean/php/stable/main/main.c:1731
#12 0x08125cac in main (argc=4, argv=0xbffffd24) at /home/sean/php/stable/sapi/cli/php_cli.c:822


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-20 23:34 UTC] fmk@php.net
This sounds like a problem with FreeTDS, but I'll take a closer look at the code.
 [2004-09-29 20:53 UTC] freddyz77 at tin dot it
I'm a FreeTDS developer. 0.53 it's quite old, we released 0.60, 0.61, and 0.62 in the meantime (and we are releasing 0.63).
 [2005-02-07 22:14 UTC] iliaa@php.net
Works with latest FreeTDS, seems like the problem was a bug in the old version(s) of FreeTDS.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 18:05:46 2022 UTC