Make code path easier for static analyzers
record->type == NULL case was handled through the record->type_length comparison. While this was correct, it is a bit difficult for static analyzers to understand, so add an extra check for NULL to avoid false reports on this. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
2efdbde276
commit
bd27b1360f
1 changed files with 4 additions and 2 deletions
|
@ -148,7 +148,8 @@ static struct wpabuf * ndef_build_record(u8 flags, void *type,
|
||||||
|
|
||||||
static int wifi_filter(struct ndef_record *record)
|
static int wifi_filter(struct ndef_record *record)
|
||||||
{
|
{
|
||||||
if (record->type_length != os_strlen(wifi_handover_type))
|
if (record->type == NULL ||
|
||||||
|
record->type_length != os_strlen(wifi_handover_type))
|
||||||
return 0;
|
return 0;
|
||||||
if (os_memcmp(record->type, wifi_handover_type,
|
if (os_memcmp(record->type, wifi_handover_type,
|
||||||
os_strlen(wifi_handover_type)) != 0)
|
os_strlen(wifi_handover_type)) != 0)
|
||||||
|
@ -173,7 +174,8 @@ struct wpabuf * ndef_build_wifi(const struct wpabuf *buf)
|
||||||
|
|
||||||
static int p2p_filter(struct ndef_record *record)
|
static int p2p_filter(struct ndef_record *record)
|
||||||
{
|
{
|
||||||
if (record->type_length != os_strlen(p2p_handover_type))
|
if (record->type == NULL ||
|
||||||
|
record->type_length != os_strlen(p2p_handover_type))
|
||||||
return 0;
|
return 0;
|
||||||
if (os_memcmp(record->type, p2p_handover_type,
|
if (os_memcmp(record->type, p2p_handover_type,
|
||||||
os_strlen(p2p_handover_type)) != 0)
|
os_strlen(p2p_handover_type)) != 0)
|
||||||
|
|
Loading…
Reference in a new issue