diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-01-28 15:33:40 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-02 16:59:29 +0100 |
commit | d66346789ccdf685a6720a739b88f194f56a60e2 (patch) | |
tree | b9c69c8801c787adbc7ec3f46f985c09599e565e /firmware/buflib.c | |
parent | d608d2203aff93d6d68e7afbac7767cf95c03b8b (diff) | |
download | rockbox-d66346789ccdf685a6720a739b88f194f56a60e2.tar.gz rockbox-d66346789ccdf685a6720a739b88f194f56a60e2.zip |
buflib: Check the validity of of handles passed to buflib_get_data() in DEBUG builds.
Change-Id: Ic274bfb4a8e1a1a10f9a54186b9173dbc0faa4c8
Diffstat (limited to 'firmware/buflib.c')
-rw-r--r-- | firmware/buflib.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c index f6a565715d..294d2926d3 100644 --- a/firmware/buflib.c +++ b/firmware/buflib.c @@ -898,6 +898,15 @@ const char* buflib_get_name(struct buflib_context *ctx, int handle) } #ifdef DEBUG + +void *buflib_get_data(struct buflib_context *ctx, int handle) +{ + if (handle <= 0) + buflib_panic(ctx, "invalid handle access: %d", handle); + + return (void*)(ctx->handle_table[-handle].alloc); +} + void buflib_check_valid(struct buflib_context *ctx) { union buflib_data *crc_slot; |