Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C6D614760CE for ; Thu, 2 Jan 2003 10:03:09 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 108FB475D6E for ; Thu, 2 Jan 2003 10:03:09 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h02F3Dd0020230; Thu, 2 Jan 2003 10:03:13 -0500 (EST) To: "Dave Page" Cc: pgsql-odbc@postgresql.org, "Didier Moens" Subject: Re: SQLGetInfo Bug In-reply-to: <03AF4E498C591348A42FC93DEA9661B88547@mail.vale-housing.co.uk> References: <03AF4E498C591348A42FC93DEA9661B88547@mail.vale-housing.co.uk> Comments: In-reply-to "Dave Page" message dated "Thu, 02 Jan 2003 14:47:41 +0000" Date: Thu, 02 Jan 2003 10:03:12 -0500 Message-ID: <20229.1041519792@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/5 X-Sequence-Number: 2504 "Dave Page" writes: > The garbage is not there if I use sprintf with a larger size of > tmp. I've tried variations of the code to check (without luck) but I > assume I'm not somehow knocking the null off the end of the string? You would be losing the trailing null if the snprintf is unable to fit its output into the buffer size it's told to use (at least, that's how most implementations of snprintf react, I think). It doesn't look like this should be enough data to overrun your buffer, but I don't have a better theory at the moment. Perhaps snprintf(tmp, sizeof(tmp) - 1, "%s %s", ...); tmp[sizeof(tmp) - 1] = '\0'; would be better coding practice if you don't want to actually check snprintf's result. regards, tom lane