mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-09 04:15:52 +00:00
Check max_len before dereferencing pointer in Cstring constructor
Fixes #4112
This commit is contained in:
parent
66feb939e6
commit
718f44ae5b
@ -552,7 +552,7 @@ class Genode::Cstring
|
||||
* null once we reach 'max_len'.
|
||||
*/
|
||||
size_t res = 0;
|
||||
for (; str && *str && res < max_len; str++, res++);
|
||||
for (; res < max_len && str && *str; str++, res++);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user