mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 21:57:55 +00:00
usb: add range check to UTF-16 string copy
This commit is contained in:
parent
4b148d896a
commit
c2e7727f46
@ -73,6 +73,10 @@ struct Usb::String
|
||||
void copy(unsigned len, void *from, Genode::Allocator *md_alloc)
|
||||
{
|
||||
length = len;
|
||||
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
string = (utf16_t *)md_alloc->alloc(length * sizeof(utf16_t));
|
||||
Genode::memcpy(string, from, sizeof(utf16_t) * length);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user