Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for seg fault# https://github.com/moxie0/tortunnel/issues/2 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion protocol/Directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,27 @@ class ExitNodeIterator {
listingEnd = directory.directoryList.rfind("\n", index);
listingStart = directory.directoryList.rfind("\n", listingEnd-1);
listingStart++;

// More generic rather than just moving 1 line above...
while (directory.directoryList[listingStart] != 'r'&& listingStart != -1) {
// go back 1 line back to find IP in correct way, which tortunnel accepts and handles else
// find way to add the address based on mac address
listingEnd = directory.directoryList.rfind("\n", listingStart);
listingStart = directory.directoryList.rfind("\n", listingEnd-1);
listingStart++;
}

index++;

if(listingStart == -1) {
boost::shared_ptr<ServerListing> null;
return null;
}

std::string listing = directory.directoryList.substr(listingStart, listingEnd-listingStart);
boost::shared_ptr<ServerListing> serverListing(new ServerListing(directory.io_service, listing));

index++;
// index++;

return serverListing;
}
Expand Down