Browse Source

check for empty URL string

pull/2121/head
orignal 4 weeks ago
parent
commit
8a8277edda
  1. 1
      libi2pd/HTTP.cpp
  2. 9
      libi2pd_client/AddressBook.cpp

1
libi2pd/HTTP.cpp

@ -103,6 +103,7 @@ namespace http
bool URL::parse(std::string_view url) bool URL::parse(std::string_view url)
{ {
if (url.empty ()) return false;
std::size_t pos_p = 0; /* < current parse position */ std::size_t pos_p = 0; /* < current parse position */
std::size_t pos_c = 0; /* < work position */ std::size_t pos_c = 0; /* < work position */
if(url.at(0) != '/' || pos_p > 0) if(url.at(0) != '/' || pos_p > 0)

9
libi2pd_client/AddressBook.cpp

@ -582,16 +582,15 @@ namespace client
} }
else else
{ {
LogPrint (eLogInfo, "Addressbook: Loading subscriptions from config file"); LogPrint (eLogInfo, "Addressbook: Loading subscriptions from config");
// using config file items // using config file items
std::string subscriptionURLs; i2p::config::GetOption("addressbook.subscriptions", subscriptionURLs); std::string subscriptionURLs; i2p::config::GetOption("addressbook.subscriptions", subscriptionURLs);
std::vector<std::string> subsList; std::vector<std::string> subsList;
boost::split(subsList, subscriptionURLs, boost::is_any_of(","), boost::token_compress_on); boost::split(subsList, subscriptionURLs, boost::is_any_of(","), boost::token_compress_on);
for (const auto& s: subsList) for (const auto& s: subsList)
{ if (!s.empty ())
m_Subscriptions.push_back (std::make_shared<AddressBookSubscription> (*this, s)); m_Subscriptions.push_back (std::make_shared<AddressBookSubscription> (*this, s));
}
LogPrint (eLogInfo, "Addressbook: ", m_Subscriptions.size (), " subscriptions urls loaded"); LogPrint (eLogInfo, "Addressbook: ", m_Subscriptions.size (), " subscriptions urls loaded");
} }
} }
@ -823,7 +822,7 @@ namespace client
} }
} }
AddressBookSubscription::AddressBookSubscription (AddressBook& book, const std::string& link): AddressBookSubscription::AddressBookSubscription (AddressBook& book, std::string_view link):
m_Book (book), m_Link (link) m_Book (book), m_Link (link)
{ {
} }

Loading…
Cancel
Save