X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C09298BA12E for ; Fri, 11 Feb 2005 18:06:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14541-01 for ; Fri, 11 Feb 2005 18:06:29 +0000 (GMT) Received: from mail21.nhs.uk (mail21.nhs.uk [62.6.139.215]) by svr1.postgresql.org (Postfix) with ESMTP id C6B9A8BA184 for ; Fri, 11 Feb 2005 18:06:29 +0000 (GMT) Received: from [10.191.254.3] (helo=relayint2.nhs.uk) by mail21.nhs.uk with esmtp (MTC MTA) id 1CzfBU-0002CQ-By for pgsql-odbc@postgresql.org; Fri, 11 Feb 2005 18:06:28 +0000 Received: from relay.nhs.uk (194.62.42.144) by relayint2.nhs.uk (Syntegra-I2 7.0.008) id 41C955B300DB6AD9 for pgsql-odbc@postgresql.org; Fri, 11 Feb 2005 18:06:28 +0000 Received: from smtp2.tayside.scot.nhs.uk (10.252.0.27) by relay.nhs.uk (Syntegra-4 7.0.008) (authenticated as smtp2_tayside_scot_nhs_uk@es2002.nhs.uk) id 420CE72100007DC6 for pgsql-odbc@postgresql.org; Fri, 11 Feb 2005 18:06:28 +0000 Received: from smtp2.tayside.scot.nhs.uk (localhost [127.0.0.1]) by localhost.tayside.scot.nhs.uk (Postfix) with ESMTP id DC1F61A6F for ; Fri, 11 Feb 2005 18:06:27 +0000 (GMT) Received: from gonzalo.tuht.scot.nhs.uk (gonzalo.tuht.scot.nhs.uk [10.252.32.96]) by smtp2.tayside.scot.nhs.uk (Postfix) with ESMTP id BE4F51A6D for ; Fri, 11 Feb 2005 18:06:27 +0000 (GMT) Received: from [192.168.1.46] (localhost [127.0.0.1]) by gonzalo.tuht.scot.nhs.uk (iPlanet Messaging Server 5.2 HotFix 1.25 (built Mar 3 2004)) with ESMTP id <0IBR004KDEARKQ@gonzalo.tuht.scot.nhs.uk> for pgsql-odbc@postgresql.org; Fri, 11 Feb 2005 18:06:27 +0000 (GMT) Date: Fri, 11 Feb 2005 18:06:27 +0000 From: Paul Cochrane Subject: Re: Bug in convert.c copy_and_convert_field In-reply-to: <420CEB3C.4050003@tuht.scot.nhs.uk> To: pgsql-odbc@postgresql.org Message-id: <420CF423.1090403@tuht.scot.nhs.uk> Organization: TORT Centre MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) References: <420CEB3C.4050003@tuht.scot.nhs.uk> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.28 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/63 X-Sequence-Number: 4953 Paul Cochrane wrote: > Hi again list. > > I think I've encountered a bug in the file convert.c - > copy_and_convert_field procedure. Unfortunately my C is a little out > of practise not having done it for 10 years or so. Can anyone help? I > think I've traced the error to the default part of the switch around > line 850 (that where the dodgy lines are being placed in the mylog > file so it's somewhere before that). Below is a snippet of the mylog > showing the problem. The lines where it is saying DEFAULT: & the ptr > part of the string. In some cases this is correct but in others there > are lots of extra / strange characters. The len field always seems to > be correct however. > > The log file ends with a single ' which may explain the error I get on > the server (1) could not receive data from client: Connection reset by > peer and (2) unexpected EOF on client connection > I've found a quick fix to this problem. I've simply added a line: strncpy(ptr+len, "\0", 1); just before the mylog line on line 850 of convert.c. I believe this simply ensures that there is a NULL at the end of the string stored in ptr. There may be a more elegant way to do this but it seems to work. Now onto the next fault cause it fails again shortly after this. Bugger! :-( Paul -- Paul Cochrane (paul.m.cochrane@tuht.scot.nhs.uk) +-------------------------------------------------------- | Tayside Orthopaedic & Rehabilitation Technology Centre | Ninewells Hospital & Medical School | Dundee, Scotland, UK. | DD1 9SY | Phone: Internal: 36284 | External: +44 (1382) 496284 | Fax: +44 (1382) 496322 +--------------------------------------------------------