another string length problem

David Reiser <[email protected]> Mon, 25 Jun 2007 22:11:05 -0400
Newsgroups gmane.comp.finance.libofx.devel
Message-ID <[email protected]>
ameritrade seems to have added some new proprietary tags that cause  
gnucash 2.x to crash in ofx_preproc.cpp similar to another string  
issue fixed last fall.

Christian Stimming sent me the attached patch to test, and it does  
keep gnucash from crashing while importing the offending file.

Dave


--
David Reiser
[email protected]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Libofx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libofx-devel
proptagfix.patch (application/octet-stream, 920 B)
? libofx-0.8.1.tar.gz
Index: lib/ofx_preproc.cpp
===================================================================
RCS file: /cvsroot/libofx/libofx/lib/ofx_preproc.cpp,v
retrieving revision 1.18
diff -u -r1.18 ofx_preproc.cpp
--- lib/ofx_preproc.cpp	24 Jan 2007 08:53:54 -0000	1.18
+++ lib/ofx_preproc.cpp	24 Jun 2007 09:13:50 -0000
@@ -470,7 +470,7 @@
       tagname_idx++;
     }
     //cerr <<i<<endl;
-    if(strip==true)
+    if(strip==true && orig_tag_open_idx < input_string.size())
       {
 	input_string.copy(buffer,(crop_end_idx-orig_tag_open_idx)+1,orig_tag_open_idx);
 	message_out(INFO,"sanitize_proprietary_tags() (end tag or new tag) removed: "+string(buffer));
@@ -484,7 +484,7 @@
       }
 
   }//end for
-  if(proprietary_tag==true){
+  if(proprietary_tag==true && orig_tag_open_idx < input_string.size()){
     if(crop_end_idx==0){//no closing tag
       crop_end_idx=input_string.size()-1;
     }