NetBpfLoad: make 2 slashes abort
This cannot happen (it's a .c misconfig if it does) Test: TreeHugger Flag: EXEMPT mainline Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I5d82c7bb8c0214f5ffcc0ce391daddb9fe6a3295
This commit is contained in:
parent
3263f9e8e9
commit
806087d4a1
1 changed files with 9 additions and 2 deletions
|
|
@ -431,8 +431,15 @@ int readCodeSections(ElfObject& elfObj, vector<codeSection>& cs) {
|
|||
|
||||
string oldName = name;
|
||||
|
||||
// convert all slashes to underscores
|
||||
std::replace(name.begin(), name.end(), '/', '_');
|
||||
// Find the first slash
|
||||
size_t first_slash_pos = name.find('/');
|
||||
|
||||
// If a slash is found, replace it
|
||||
if (first_slash_pos != std::string::npos) {
|
||||
name[first_slash_pos] = '_';
|
||||
|
||||
if (name.find('/') != std::string::npos) abort(); // There should only be one!
|
||||
}
|
||||
|
||||
cs_temp.name = name;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue