Parcourir la source

NFC: Avoid Null pointer de-referencing

Null pointer check is added in the send_ese_cmd function
to avoid null pointer dereferencing.

Change-Id: Ia577ba3b649b2a33076a2b33c3b20c3f1fffac85
Bhuvan Varshney il y a 2 ans
Parent
commit
585ccc9bf8
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      nfc/ese_cold_reset.c

+ 2 - 0
nfc/ese_cold_reset.c

@@ -82,6 +82,8 @@ static int send_ese_cmd(struct nfc_dev *nfc_dev)
 				"cannot send ese cmd as NFCC powered off\n");
 		return -ENODEV;
 	}
+	if (nfc_dev->cold_reset.cmd_buf == NULL)
+		return -EFAULT;
 
 	ret = nfc_dev->nfc_write(nfc_dev, nfc_dev->cold_reset.cmd_buf,
 						nfc_dev->cold_reset.cmd_len,