Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeIQI-0006Gd-RO for pgsql-odbc@arkaria.postgresql.org; Tue, 22 Sep 2015 07:55:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZeIQH-00010i-B8 for pgsql-odbc@arkaria.postgresql.org; Tue, 22 Sep 2015 07:55:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZeIPu-0000Xu-Cq for pgsql-odbc@postgresql.org; Tue, 22 Sep 2015 07:55:10 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZeIPr-00087O-DN for pgsql-odbc@postgresql.org; Tue, 22 Sep 2015 07:55:08 +0000 Received: by pacfv12 with SMTP id fv12so2372041pac.2 for ; Tue, 22 Sep 2015 00:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=rWA7hMezA0dcuzDVfSJOyEVEsdr58a6M849fzFyRxOs=; b=wLGjhceYKUw898KhX8yyBCILG61BKlgd1mGnw4uJkn8U9UiIVimQJd1je1C3ccoTiH gY9TLIF85s95Cc6FUHKgKToJ/Y3akiFveDFh6aS9H/JjfAZdsyRzJpsDWZW+khrUJq9O IodUqGc2AISNFTj7c8QcyxAQzANSqpCNtbxSsiCmy6dqrQXwXaMZBPefsXxcXokrurHz 6crEaNR7AuQ52BgVTJ9JjX4JLKKbil2aFrEcJ5lnADiTrykoTgJpg3FVZByl+5Zqn+N1 PJktWAcGZZjqSJV7cDTteJ7ZHqbiHvY7Ekb3v/uFCuTZLI9J8b4LQgaWQjJ1XMFpE+bh gMOA== X-Received: by 10.66.193.162 with SMTP id hp2mr29890703pac.108.1442908506310; Tue, 22 Sep 2015 00:55:06 -0700 (PDT) Received: from [192.168.1.110] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id gd2sm572732pbb.41.2015.09.22.00.55.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Sep 2015 00:55:05 -0700 (PDT) Message-ID: <56010956.1060108@iki.fi> Date: Tue, 22 Sep 2015 10:55:02 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Naoya Anzai , "pgsql-odbc@postgresql.org" CC: Akio Iwaasa Subject: Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows. References: <116262CF971C844FB6E793F8809B51C6EF245E@BPXM02GP.gisp.nec.co.jp> In-Reply-To: <116262CF971C844FB6E793F8809B51C6EF245E@BPXM02GP.gisp.nec.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 09/16/2015 05:20 AM, Naoya Anzai wrote: > Hi, > > I found a bug which psqlODBC returns a string without null-terminated when SQLFetch is executed on Windows. > IMHO, it seems to be caused by differences of snprintf function between Windows and Linux. > You have changed sprintf into snprintf at psqlodbc-09.03.0400 release. > But snprintf on Windows(_snprintf) doesn't include a terminating character(\0) when a copy buffer length is less than an original buffer length; besides this returns -1. > Their behavior are different from that of Linux but psqlODBC does not currently make allowances for their differences. > > As you can confirm this bug, I attached a program(test.cpp) which reproduces a bug. Yep. This was already fixed in git master in January, in commit 532c0dad20087201feee3851652c114eb820311f. We're long overdue for a release... - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc