mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 10:02:02 +02:00
nfc: llcp: fix WKS SAP hijacking via prefix match in nfc_llcp_wks_sap()
nfc_llcp_wks_sap() compares only service_name_len bytes, so a short
service_name like "u" matches longer WKS strings like "urn:nfc:sn:snep".
Fix by requiring exact length match before strncmp().
Fixes: d646960f79 ("NFC: Initial LLCP support")
Signed-off-by: Ömer Mete Kaya <omermetekaya0@gmail.com>
Link: https://patch.msgid.link/20260909121437.33744-1-omermetekaya0@gmail.com
Signed-off-by: David Heidelberg <david@ixit.cz>
This commit is contained in:
parent
c04981e42d
commit
408cff6bd6
|
|
@ -369,7 +369,8 @@ static int nfc_llcp_wks_sap(const char *service_name, size_t service_name_len)
|
|||
if (wks[sap] == NULL)
|
||||
continue;
|
||||
|
||||
if (strncmp(wks[sap], service_name, service_name_len) == 0)
|
||||
if (strlen(wks[sap]) == service_name_len &&
|
||||
!strncmp(wks[sap], service_name, service_name_len))
|
||||
return sap;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user