mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Check max_len before dereferencing pointer in Cstring constructor
Fixes #4112
This commit is contained in:
@@ -552,7 +552,7 @@ class Genode::Cstring
|
|||||||
* null once we reach 'max_len'.
|
* null once we reach 'max_len'.
|
||||||
*/
|
*/
|
||||||
size_t res = 0;
|
size_t res = 0;
|
||||||
for (; str && *str && res < max_len; str++, res++);
|
for (; res < max_len && str && *str; str++, res++);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user