From 035b692673522eca1665f34cdc485f5a9d1374d2 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 11 Aug 2022 15:57:40 +0200 Subject: gtlv: check memory bounds 3/3: encoding to str See Id8d997c9d5e655ff1842ec69eab6c073875c6330 Related: CID#275417 Related: SYS#5599 Change-Id: I63d52a4f5dba32d3a3887dd9c5e42e1695fb2aa3 --- include/osmocom/gtlv/gtlv_dec_enc.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/osmocom/gtlv/gtlv_dec_enc.h b/include/osmocom/gtlv/gtlv_dec_enc.h index 2126beb..e671022 100644 --- a/include/osmocom/gtlv/gtlv_dec_enc.h +++ b/include/osmocom/gtlv/gtlv_dec_enc.h @@ -191,10 +191,12 @@ int osmo_gtlvs_encode(struct osmo_gtlv_put *gtlv, const void *decoded_struct, si unsigned int obj_ofs, const struct osmo_gtlv_coding *ie_coding, osmo_gtlv_err_cb err_cb, void *err_cb_data, const struct value_string *iei_strs); -int osmo_gtlvs_encode_to_str_buf(char *buf, size_t buflen, const void *decoded_struct, unsigned int obj_ofs, - const struct osmo_gtlv_coding *ie_coding, const struct value_string *iei_strs); -char *osmo_gtlvs_encode_to_str_c(void *ctx, const void *decoded_struct, unsigned int obj_ofs, - const struct osmo_gtlv_coding *ie_coding, const struct value_string *iei_strs); +int osmo_gtlvs_encode_to_str_buf(char *buf, size_t buflen, + const void *decoded_struct, size_t decoded_struct_size, unsigned int obj_ofs, + const struct osmo_gtlv_coding *ie_coding, const struct value_string *iei_strs); +char *osmo_gtlvs_encode_to_str_c(void *ctx, + const void *decoded_struct, size_t decoded_struct_size, unsigned int obj_ofs, + const struct osmo_gtlv_coding *ie_coding, const struct value_string *iei_strs); static inline bool osmo_gtlv_coding_end(const struct osmo_gtlv_coding *iec) { -- cgit v1.2.3