Re: Fix for crash in libofx-0.6.2/ofx2qif

Benoit Grégoire <[email protected]>
Newsgroups gmane.comp.finance.libofx.devel
Message-ID <[email protected]>
On February 24, 2003 04:46 am, you wrote:
> Hello,
>
>   I'm using ofx2qif to import my banking information into an older
> version of GNUcash, and I ran into a bug that caused ofx2qif to
> segfault consistently on some datafiles.
>
>   The problem ended up being in ofx_proc_transaction_cb.  Strings are
> appended to the trans_list_buff variable, but it's never initialized
> to anything, so it can end up with gibberish in it.
>
>   I also made some changes that should help prevent buffer overflow
> (the string length limit in strncat is calculated based on the size of
> trans_list_buff, instead of OFX_FILE_MAX_SIZE, and sprintf calls limit
> the length of their string arguments with things like "%.4000s"),
> prevent printf-format problems (by avoiding using data that comes from
> the OFX file as the first argument to sprintf), and a few other small
> changes (like avoiding sprintf when strcpy would do).
>
>   With these changes, ofx2qif works perfectly.
>
>   Let me know if you have any questions, concerns, etc.  I'd live to
> see this patch included in a future release of libofx.

Thanks for the patch, I applied most of it to CVS.  I didn't apply the .4000s, 
because string length are already checked in the library, and most of 
ofx2qif's code will soon be swallowed in the library itself.

Have a nice day,
-- 
Benoit Grégoire
http://step.polymtl.ca/~bock/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.