aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/sec.c
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-08-03 11:10:50 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-08-03 11:10:50 +0200
commit5e4cb302a7e9ccf935c3b47063cbffa389cc9c25 (patch)
tree61b0093d3cac075334b1f130ba6438d47241c93c /samsung-ipc/sec.c
parent7d2ebf43876c1550f7671092589b625324f860bb (diff)
downloadexternal_libsamsung-ipc-5e4cb302a7e9ccf935c3b47063cbffa389cc9c25.zip
external_libsamsung-ipc-5e4cb302a7e9ccf935c3b47063cbffa389cc9c25.tar.gz
external_libsamsung-ipc-5e4cb302a7e9ccf935c3b47063cbffa389cc9c25.tar.bz2
sec: Size function for helpers that return data with non-explicit size
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc/sec.c')
-rw-r--r--samsung-ipc/sec.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/samsung-ipc/sec.c b/samsung-ipc/sec.c
index be5dccf..8ec633f 100644
--- a/samsung-ipc/sec.c
+++ b/samsung-ipc/sec.c
@@ -120,6 +120,22 @@ int ipc_sec_change_locking_pw_setup(struct ipc_sec_change_locking_pw_data *data,
return 0;
}
+size_t ipc_sec_rsim_access_size_setup(struct ipc_sec_rsim_access_request_header *header,
+ const void *sim_io_data, size_t sim_io_size)
+{
+ size_t size;
+
+ if (header == NULL)
+ return 0;
+
+ if (sim_io_data == NULL)
+ sim_io_size = 0;
+
+ size = sizeof(struct ipc_sec_rsim_access_request_header) + sim_io_size;
+
+ return size;
+}
+
void *ipc_sec_rsim_access_setup(struct ipc_sec_rsim_access_request_header *header,
const void *sim_io_data, size_t sim_io_size)
{
@@ -133,7 +149,9 @@ void *ipc_sec_rsim_access_setup(struct ipc_sec_rsim_access_request_header *heade
if (sim_io_data == NULL)
sim_io_size = 0;
- size = sizeof(struct ipc_sec_rsim_access_request_header) + sim_io_size;
+ size = ipc_sec_rsim_access_size_setup(header, sim_io_data, sim_io_size);
+ if (size == 0)
+ return NULL;
data = calloc(1, size);