]> git.tuebingen.mpg.de Git - paraslash.git/commit
load_chunk_table(): Don't trust afhi->chunks_total.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 26 Dec 2016 22:50:34 +0000 (23:50 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 25 Mar 2017 10:54:36 +0000 (11:54 +0100)
commit5afe721aeb241bd21b832994ec2f2b7d8ff84766
treed4ad964806ef31b296d3649e5aef7b76c2bc68b0
parente0f54e42887a8beef092755f5ed9cdf6d499bef2
load_chunk_table(): Don't trust afhi->chunks_total.

Both callers pass a buffer to load_chunk_table() to initialize
afhi->chunk_table. The function does not check the size of the passed
buffer but relies on afhi->chunks_total to tell how many values to
copy from the buffer.

In other words, the buffer size gives an upper bound for the number of
chunks in the chunk table, but this bould is not checked. This patch
makes the code more robust by adding a suitable check. To this aim,
load_chunk_table() is changed to receive a pointer to an osl object
(which contains the buffer size) rather than only the buffer.

One caller, load_afd(), initializes the chunk table from a shared
memory area buffer. It does not know or care about the buffer size
so far. We introduce the the new IPC helper shm_size() to let it tell
the size of the area and pass it to load_chunk_table().
aft.c
ipc.c
ipc.h