Adding robustness to t3t callback function
Adding NULL pointer checks to fix a couple of suspicious pointer
dereference warnings found by the Klocwork source code analysis
tool.
The same NULL checks exist already in the corresponding t1t and
t2t callback functions (in rw_t1t.c and rw_t2t.c respectively).
Therefore considered valid and relevant in the t3t function as
well.
Change-Id: Ib432f7b63647f2dac8683b66067b970e3888d146
Signed-off-by: Ken Wahid <kenx.wahid@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
diff --git a/src/nfc/tags/rw_t3t.c b/src/nfc/tags/rw_t3t.c
index 7db0fac..b373ce9 100644
--- a/src/nfc/tags/rw_t3t.c
+++ b/src/nfc/tags/rw_t3t.c
@@ -2363,8 +2363,9 @@
break;
case NFC_DATA_CEVT: /* check for status in tNFC_CONN */
- if ( (p_data->data.status == NFC_STATUS_OK)
- ||(p_data->data.status == NFC_STATUS_CONTINUE) )
+ if ( (p_data != NULL)
+ &&( (p_data->data.status == NFC_STATUS_OK)
+ ||(p_data->data.status == NFC_STATUS_CONTINUE) ) )
{
rw_t3t_data_cback (conn_id, &(p_data->data));
break;
@@ -2381,7 +2382,7 @@
if (event == NFC_ERROR_CEVT)
rw_t3t_process_error (NFC_STATUS_TIMEOUT);
- else
+ else if (p_data)
rw_t3t_process_error (p_data->status);
break;