diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2014-08-03 11:10:50 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2014-08-03 11:10:50 +0200 |
commit | 5e4cb302a7e9ccf935c3b47063cbffa389cc9c25 (patch) | |
tree | 61b0093d3cac075334b1f130ba6438d47241c93c | |
parent | 7d2ebf43876c1550f7671092589b625324f860bb (diff) | |
download | external_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>
-rw-r--r-- | include/sec.h | 2 | ||||
-rw-r--r-- | samsung-ipc/sec.c | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/include/sec.h b/include/sec.h index 7a1d178..882b586 100644 --- a/include/sec.h +++ b/include/sec.h @@ -173,6 +173,8 @@ int ipc_sec_phone_lock_request_set_setup(struct ipc_sec_phone_lock_request_set_d int ipc_sec_change_locking_pw_setup(struct ipc_sec_change_locking_pw_data *data, unsigned char facility_type, const char *password_old, const char *password_new); +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); void *ipc_sec_rsim_access_setup(struct ipc_sec_rsim_access_request_header *header, const void *sim_io_data, size_t sim_io_size); int ipc_sec_lock_infomation_setup(struct ipc_sec_lock_infomation_request_data *data, 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); |