Better checking on *buf bounds, should eliminate possible problems (which aren't at all likely).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16499 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
866d738a05
commit
43d0f55b38
@ -148,12 +148,17 @@ my_device_read (void* cookie, off_t position, void *buf, size_t* num_bytes)
|
||||
{
|
||||
size_t bytes = 0;
|
||||
|
||||
if (position > 0) {
|
||||
*num_bytes = 0;
|
||||
} else {
|
||||
if (position == 0) { // First read
|
||||
dump_acpi_namespace("\\", buf, &bytes, 0);
|
||||
*num_bytes = bytes;
|
||||
dprintf("num_bytes %lu\n", *num_bytes);
|
||||
if (bytes <= *num_bytes) {
|
||||
*num_bytes = bytes;
|
||||
dprintf("acpi_ns_dump: read %lu bytes\n", *num_bytes);
|
||||
} else {
|
||||
*num_bytes = 0;
|
||||
return B_IO_ERROR;
|
||||
}
|
||||
} else {
|
||||
*num_bytes = 0;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user