If the server command "ls" is executed with the -c option to print
the chunk table, we assume that afhi->chunks_total many chunks are
stored in the osl disk object that represents the chunk table.
This should be true in general, but since we also know the size of
the osl object, it does not hurt to check this bound as well and
break out of the loop if the next read would access memory beyond
the end of the object.
(long unsigned) d->afhi.chunk_tv.tv_usec
);
buf = chunk_table_obj.data;
- for (i = 0; i <= d->afhi.chunks_total; i++)
+ for (
+ i = 0;
+ i <= d->afhi.chunks_total && 4 * i + 3 < chunk_table_obj.size;
+ i++
+ )
para_printf(b, "%u ", (unsigned) read_u32(buf + 4 * i));
para_printf(b, "\n");
ret = 1;