mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Merge #3852
3852: Fix (harmless) array OOB access when no pings were cached r=def- a=heinrich5991 Use `vector.data()` instead of `&vector[0]` to get access to the underlying array. Fixes #3850. <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
dbf1624a9f
|
@ -197,7 +197,7 @@ void CServerBrowserPingCache::GetPingCache(const CEntry **ppEntries, int *pNumEn
|
||||||
}
|
}
|
||||||
m_aNewEntries.clear();
|
m_aNewEntries.clear();
|
||||||
}
|
}
|
||||||
*ppEntries = &m_aEntries[0];
|
*ppEntries = m_aEntries.data();
|
||||||
*pNumEntries = m_aEntries.size();
|
*pNumEntries = m_aEntries.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue