dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmocore/+/28486 )
Change subject: tlv_parser: initialize output values
......................................................................
tlv_parser: initialize output values
When the function tlv_parse_one exits early, the output parameters may
not be initialized. This is no problem since the return code will inform
the caller that the parsing of the TLV IE failed. However, coverity
seems to report a TAINTED_SCALAR problem anyway.
Change-Id: I87570ece10fbf64f3a57b34d84f8c843871f0db1
Related: CID#273004
---
M src/gsm/tlv_parser.c
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/28486/1
diff --git a/src/gsm/tlv_parser.c b/src/gsm/tlv_parser.c
index c5aac97..069f1a0 100644
--- a/src/gsm/tlv_parser.c
+++ b/src/gsm/tlv_parser.c
@@ -234,6 +234,12 @@
uint8_t tag;
int len; /* number of bytes consumed by TLV entry */
+ /* Make output variables are initialized
+ * (fixes CID 273004, false positive) */
+ *o_tag = 0x00;
+ *o_len = 0;
+ *o_val = NULL;
+
if (buf_len < 1)
return OSMO_TLVP_ERR_OFS_BEYOND_BUFFER;
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/28486
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I87570ece10fbf64f3a57b34d84f8c843871f0db1
Gerrit-Change-Number: 28486
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange