Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hgAtb-000379-IS for pgsql-odbc@arkaria.postgresql.org; Wed, 26 Jun 2019 16:35:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hgAta-0005QV-9p for pgsql-odbc@arkaria.postgresql.org; Wed, 26 Jun 2019 16:35:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hgAta-0005QO-2w for pgsql-odbc@lists.postgresql.org; Wed, 26 Jun 2019 16:35:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hgAtX-00018i-Fc for pgsql-odbc@lists.postgresql.org; Wed, 26 Jun 2019 16:35:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x5QGZbxb009380; Wed, 26 Jun 2019 12:35:37 -0400 From: Tom Lane To: pgsql-odbc@lists.postgresql.org cc: Werewolf Subject: Fwd: ODBC: SQLGetDescField returns incorrect length for SQL_DESC_COUNT field of APD MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9378.1561566937.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 26 Jun 2019 12:35:37 -0400 Message-ID: <9379.1561566937@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Forwarding to correct list ... ------- Forwarded Message Date: Wed, 26 Jun 2019 19:00:58 +0300 From: Werewolf To: pgsql-bugs@lists.postgresql.org 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