|  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
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: 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
 [2004-04-20 19:41 UTC]
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/
#1  0x4027470d in dblib_handle_err_message () from /usr/lib/
#2  0x4027852e in tds_process_column_row () from /usr/lib/
#3  0x4027697f in tds_process_default_tokens () from /usr/lib/
#4  0x40276b5d in tds_process_login_tokens () from /usr/lib/
#5  0x40279c6c in tds_connect () from /usr/lib/
#6  0x40271e33 in tdsdbopen () from /usr/lib/
#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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-20 23:34 UTC]
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]
Works with latest FreeTDS, seems like the problem was a bug in the old version(s) of FreeTDS.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 20:01:30 2024 UTC