Skip to Content.
Sympa Menu

freetds - [freetds] 0.62rc3 + Sybase ASA: good except tsql - here's a patch

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: L J Bayuk <ljb220 AT mindspring.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] 0.62rc3 + Sybase ASA: good except tsql - here's a patch
  • Date: Thu, 8 Jan 2004 21:20:37 -0500 (GMT-05:00)

[Sorry - I didn't mean to wait until just before release, but my last 2
tries at posting this went nowhere. I think your mail list server hates me.]

I'm using FreeTDS-0.62rc3 (on Linux/i386) talking to Sybase ASA 8.0.2 on
Netware 6. I built FreeTDS with sqsh-2.1 and PHP-4.3.3 (sybase_ct
extension), both of which work fine. (0.61* was not usable for me with ASA.)

tsql crashes (segfault) on connecting to ASA. There seems to be problem
with charsets between my ASA setup and tsql. I don't know how to fix that,
but I suggest applying the patch below to prevent the TDS library from
crashing in this case. Tsql works after I use the patch.

The crash is in tds/iconv.c when tds_srv_charset_changed() calls
strcmp(canonic_charset, iconv_info->server_charset.name)
with canonic_charset==NULL. What happens: tsql sent charset
"ANSI_X3.4-1968" (I have no clue where it got that) to the ASA server,
which responds with an ENVCHANGE to charset "unknown".
tds_process_env_chg() tries to convert that to a charset name with
tds_canonical_charset_name() and gets a NULL pointer back, passes that as
canonic_charset in strcmp above and segfaults.

--- src/tds/iconv.c.bak 2003-12-29 11:08:35.000000000 -0500
+++ src/tds/iconv.c 2004-01-07 08:53:17.000000000 -0500
@@ -959,6 +959,10 @@
TDSICONVINFO *iconv_info = tds->iconv_info[client2server_chardata];
const char *canonic_charset = tds_canonical_charset_name(charset);

+ /* ignore request to change to unknown charset */
+ if (!canonic_charset)
+ return;
+
if (strcmp(canonic_charset, iconv_info->server_charset.name) == 0)
return;





Archive powered by MHonArc 2.6.24.

Top of Page