1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

Shell: Avoid StringView OOB access in Formatter ctor

This commit is contained in:
Ali Mohammad Pur 2022-08-10 22:07:00 +04:30 committed by Ali Mohammad Pur
parent bbce061a61
commit c90cf67dc6

View file

@ -24,6 +24,9 @@ public:
, m_source(source)
, m_cursor(cursor)
{
if (m_source.is_empty())
return;
size_t offset = 0;
for (auto ptr = m_source.end() - 1; ptr >= m_source.begin() && isspace(*ptr); --ptr)
++offset;