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.92) (envelope-from ) id 1jGA5f-0000RX-56 for pgsql-odbc@arkaria.postgresql.org; Sun, 22 Mar 2020 23:33:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGA5d-0007hn-Qi for pgsql-odbc@arkaria.postgresql.org; Sun, 22 Mar 2020 23:33:09 +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 1jG0tk-000252-0d for pgsql-odbc@lists.postgresql.org; Sun, 22 Mar 2020 13:44:16 +0000 Received: from server.mutech.ch ([51.68.154.10]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jG0tZ-00058G-FH for pgsql-odbc@postgresql.org; Sun, 22 Mar 2020 13:44:12 +0000 Received: from mail.mutech.ch (localhost [127.0.0.1]) by server.mutech.ch (Postfix) with ESMTP id CF1CF250008F for ; Sun, 22 Mar 2020 13:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mutech.ch; s=alternc; t=1584884639; bh=1rdZLVtLBOPYj76/8KBQFFhmm/+oFQGTYSMe3piMFlM=; h=Date:From:To:Subject; b=QhjkOM9O0+cTCgrCCXP/0trAPTP7a3C2x6DIFqz6C4PTYnwocIzsgkqUIijdj6h3+ xAmjFD2uGbpZkKHqEcbrMq8wiYILTmz5DV7Jj+K+Rq6SZ+cGz6suytN/djJDA0kOoj gYRgU1BvOy6QCtlUq99XcgmumjzzcOVWTrjEHYKzF7zZz1VChoL3cUSqGJuup5R1wj w3o MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 22 Mar 2020 14:43:59 +0100 From: martial.guex@mutech.ch To: pgsql-odbc@postgresql.org Subject: Patch to solve memory protect violation and clear __error_number after call CC_lookup_characterset Message-ID: X-Sender: martial.guex@mutech.ch User-Agent: Roundcube Webmail/1.3.10 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I have detected fatal memory error protection on call strdup connectio.c(1045) and wrong setting conn.__error_number on CC_lookup_lo when "select oid, typbasetype from pg_type where typname = 'lo'" doesn't return any record. I used this patch to solve the problem on debian stretch with odbc-postgresql:amd64 version 1:09.05.0400-2. --- psqlodbc-09.05.0400.orig/connection.c +++ psqlodbc-09.05.0400/connection.c @@ -1041,12 +1041,13 @@ CC_connect(ConnectionClass *self, char * if (retsend) retsend = CC_send_settings(self, GET_NAME(self->connInfo.conn_settings)); - if (CC_get_errornumber(self) > 0) + if ((CC_get_errornumber(self) > 0) && (CC_get_errormsg(self) != NULL)) saverr = strdup(CC_get_errormsg(self)); CC_clear_error(self); /* clear any error */ CC_lookup_lo(self); /* a hack to get the oid of our large object oid type */ + CC_clear_error(self); /* clear any error */ /* Multibyte handling */ CC_lookup_characterset(self); if (CC_get_errornumber(self) > 0) It's probably better to clear self.__error_number directly on CC_lookup_lo and when error_number is equal 110. Thank's for the job. -- ------------------------------------------ Martial Guex Route des Alpes 7 1452 Les Rasses Tél: +41 24 454 46 35 Fax: +41 24 454 46 32 Mobile: +41 79 767 27 02 Email: martial.guex@mutech.ch WhatsApp:+41 79 767 27 02