Fwd: ODBC: SQLGetDescField returns incorrect length for SQL_DESC_COUNT field of APD

Tom Lane <[email protected]> Wed, 26 Jun 2019 12:35:37 -0400
Newsgroups gmane.comp.db.postgresql.odbc
Message-ID <[email protected]>
Forwarding to correct list ...

------- Forwarded Message

Date:    Wed, 26 Jun 2019 19:00:58 +0300
From:    Werewolf <[email protected]>
To:      [email protected]
Subject: ODBC: SQLGetDescField returns incorrect length for SQL_DESC_COUNT
	 field of APD

Field SQL_DESC_COUNT should fit into a variable of type SQLSMALLINT. But =

when retrieving this field of APD SQLGetDescField returns SQLINTEGER =

value. So memory corruption is possible in application using psqlodbc =

driver.
Also the function returns an undefined error code -8.

The mistake is located here
https://git.postgresql.org/gitweb/?p=3Dpsqlodbc.git;a=3Dblob;f=3Dpgapi30.c=
;h=3Dba0dd6d731bbccd81392def43ae9b10e9c013aef;hb=3DHEAD#l1240

Just replace 'ret =3D SQL_IS_SMALLINT;' with 'rettype =3D SQL_IS_SMALLINT;=
'.

------- End of Forwarded Message