libftdi Archives

Subject: Re: Bug in ftdi_read_data

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 17 Aug 2010 11:05:41 +0200
>>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> writes:

    Thomas> Hello Hermann, On Monday, 16. August 2010 00:12:51 Hermann Kraus
    Thomas> wrote:
    >> The current git version of libftdi contains a critical bug in
    >> ftdi_read_data. If a read from the device returns more data than
    >> requested the function exits with error -127 (documented as "// never
    >> reached") instead of a correct return code.
    >> The attached patch fixes this problem.

    Thomas> Thanks for reporting this. IIRC the code change is related to
    Thomas> the recent "Let ftdi_read_data() honor usb_read_timeout"
    Thomas> commit. The proposed fix would revert an intentional (?) part of
    Thomas> Uwe's change and I guess this could break the timeout code. Uwe,
    Thomas> can you take a look?

I think Hermanns solution is right. When the amount of data requested has
been read, the function should return.

Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread