Обсуждение: Re: [HACKERS] unixODBC (again)

Поиск
Список
Период
Сортировка

Re: [HACKERS] unixODBC (again)

От
Hiroshi Inoue
Дата:
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