mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 08:50:37 +00:00
LibCore: Handle null lines in ConfigFile
Fixes nullptr dereference when trying to read binary files.
This commit is contained in:
parent
f71584b917
commit
0badfd7b32
Notes:
sideshowbarker
2024-07-17 20:32:59 +09:00
Author: https://github.com/sppmacd Commit: https://github.com/SerenityOS/serenity/commit/0badfd7b323 Pull-request: https://github.com/SerenityOS/serenity/pull/11488 Reviewed-by: https://github.com/awesomekling
1 changed files with 6 additions and 0 deletions
|
@ -76,6 +76,12 @@ void ConfigFile::reparse()
|
||||||
|
|
||||||
while (m_file->can_read_line()) {
|
while (m_file->can_read_line()) {
|
||||||
auto line = m_file->read_line();
|
auto line = m_file->read_line();
|
||||||
|
|
||||||
|
if (line.is_null()) {
|
||||||
|
m_groups.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto* cp = line.characters();
|
auto* cp = line.characters();
|
||||||
|
|
||||||
while (*cp && (*cp == ' ' || *cp == '\t' || *cp == '\n'))
|
while (*cp && (*cp == ' ' || *cp == '\t' || *cp == '\n'))
|
||||||
|
|
Loading…
Reference in a new issue