Re: [HACKERS] unixODBC (again) - Mailing list pgsql-odbc

From Hiroshi Inoue
Subject Re: [HACKERS] unixODBC (again)
Date
Msg-id 3A81E9C9.4104C3FD@tpf.co.jp
Whole thread Raw
List pgsql-odbc
Nick Gorham wrote:

>
> Then having sorted this out, I get a core dump, that I have traced to
> CC_lookup_pg_version, the code did
>
>     CC_lookup_pg_version(ConnectionClass *self)
>     {
>     HSTMT hstmt;
>     StatementClass *stmt;
>     RETCODE result;
>     char *szVersion = "0.0";
>     static char *func = "CC_lookup_pg_version";
>
> Then later did a
>
>     sprintf( szVersion... );
>
> This seems to be trying to write into, what the compiler is marking as
> read only storage. A quick change to
>

You are right, it seems a misuse of char *.

>     CC_lookup_pg_version(ConnectionClass *self)
>     {
>     HSTMT hstmt;
>     StatementClass *stmt;
>     RETCODE result;
>     char szVersion[ 3 ];
>     static char *func = "CC_lookup_pg_version";
>
>         strcpy( szVersion, "0.0" );
>

szVersion[3] seems too short.
I would increase the length and commit it soon.

Regards,
Hiroshi Inoue

pgsql-odbc by date:

Previous
From: "Adam Lang"
Date:
Subject: Re: Re: 7.1 beta 4 ODBC Connection Problem
Next
From: Hiroshi Inoue
Date:
Subject: Re: Visio, new DLL