From 22942dc70b8de21814b0030009945d84882e6468 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 1 Oct 2017 20:20:26 +0200 Subject: [PATCH] fixed bug causing suffix/prefix lists to contain an empty string --- libretroshare/src/file_sharing/p3filelists.cc | 4 +++- retroshare-gui/src/gui/settings/TransferPage.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 5748a3b58..5c2018ce1 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -478,7 +478,9 @@ bool p3FileDatabase::loadList(std::list& load) for(uint32_t i=0;ivalue.size();++i) if(kit->value[i] == ';') { - ignored_prefixes.push_back(b) ; + if(!b.empty()) // security! + ignored_prefixes.push_back(b) ; + b.clear(); } else diff --git a/retroshare-gui/src/gui/settings/TransferPage.cpp b/retroshare-gui/src/gui/settings/TransferPage.cpp index 309990d3e..a4c6a1b9d 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.cpp +++ b/retroshare-gui/src/gui/settings/TransferPage.cpp @@ -70,8 +70,8 @@ void TransferPage::updateIgnoreLists() if(ui.suffixesIgnoreList_CB->isChecked()) flags |= RS_FILE_SHARE_FLAGS_IGNORE_SUFFIXES ; std::list lp,ls ; - { QStringList L = ui.prefixesIgnoreList_LE->text().split(';') ; for(QStringList::const_iterator it(L.begin());it!=L.end();++it) lp.push_back((*it).toStdString()) ; } - { QStringList L = ui.suffixesIgnoreList_LE->text().split(';') ; for(QStringList::const_iterator it(L.begin());it!=L.end();++it) ls.push_back((*it).toStdString()) ; } + { QStringList L = ui.prefixesIgnoreList_LE->text().split(';') ; for(QStringList::const_iterator it(L.begin());it!=L.end();++it) if(!(*it).isNull()) lp.push_back((*it).toStdString()) ; } + { QStringList L = ui.suffixesIgnoreList_LE->text().split(';') ; for(QStringList::const_iterator it(L.begin());it!=L.end();++it) if(!(*it).isNull()) ls.push_back((*it).toStdString()) ; } rsFiles->setIgnoreLists(lp,ls,flags) ;