Killing me softly with character arrays

Once again, by attempting a fix, I have made things worse. In trying to get Tellico to properly read non-latin1 characters when searching, I introduced a likely segfault in version 0.13.4, since strlen() gets called on a non-nul-terminated character array.

--- src/fetch/amazonfetcher.cpp (revision 1125)
+++ src/fetch/amazonfetcher.cpp (working copy)
@@ -370,7 +370,7 @@
   // assume amazon is always utf-8
-  QString str = s_xsltHandler->applyStylesheet(QString::fromUtf8(m_data));
+  QString str = s_xsltHandler->applyStylesheet(QString::fromUtf8(m_data, m_data.size()));
   Import::TellicoImporter imp(str);
   Data::Collection* coll = imp.collection();
   for(Data::EntryListIterator it(coll->entryList()); it.current(); ++it) {

I also have a fix for searching with Japanese characters, that I think may work, but of course, I don't run my computer in a Japanese locale. I guess I'll put out a version 0.13.5 sometime soon, since I hate the idea of a user trying to search Amazon and having Tellico crash. Thanks to Aglef Kaiser for the bug report and fix.

Recent Entries