Skip to content

Commit decd5ad

Browse files
committed
Fix segfault on unique interface name list generation (for multipath)
1 parent 29e7fa5 commit decd5ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

osdep/Binder.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,11 @@ class Binder
348348
}
349349

350350
// Generate set of unique interface names (used for formation of logical link set in multipath code)
351+
// TODO: Could be gated not to run if multipath is not enabled.
351352
for(std::map<InetAddress,std::string>::const_iterator ii(localIfAddrs.begin());ii!=localIfAddrs.end();++ii) {
352353
linkIfNames.insert(ii->second);
353354
}
354-
for (std::set<std::string>::iterator si(linkIfNames.begin());si!=linkIfNames.end();si++) {
355+
for (std::set<std::string>::iterator si(linkIfNames.begin());si!=linkIfNames.end();) {
355356
bool bFoundMatch = false;
356357
for(std::map<InetAddress,std::string>::const_iterator ii(localIfAddrs.begin());ii!=localIfAddrs.end();++ii) {
357358
if (ii->second == *si) {
@@ -360,7 +361,10 @@ class Binder
360361
}
361362
}
362363
if (!bFoundMatch) {
363-
linkIfNames.erase(si);
364+
linkIfNames.erase(si++);
365+
}
366+
else {
367+
++si;
364368
}
365369
}
366370

0 commit comments

Comments
 (0)