Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH v2 2/4] scan: validate OWE transition operating class/channel
@ 2021-09-22 19:34 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2021-09-22 19:34 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

If the IE's operating class and channel doesn't validate don't bother
storing the IE at all.
---
 src/scan.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/scan.c b/src/scan.c
index 54a7bc84..3f36ea3e 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -1063,11 +1063,19 @@ static void scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
 		bss->owe_trans = l_new(struct ie_owe_transition_info, 1);
 
 		if (ie_parse_owe_transition(data - 2, len + 2,
-						bss->owe_trans) < 0) {
-			l_free(bss->owe_trans);
-			bss->owe_trans = NULL;
-		}
+						bss->owe_trans) < 0)
+			goto free_owe_trans;
+
+		if (bss->owe_trans->oper_class && oci_to_frequency(
+						bss->owe_trans->oper_class,
+						bss->owe_trans->channel) < 0)
+			goto free_owe_trans;
+
+		return;
 
+free_owe_trans:
+		l_free(bss->owe_trans);
+		bss->owe_trans = NULL;
 		return;
 	}
 
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread
* Re: [PATCH v2 2/4] scan: validate OWE transition operating class/channel
@ 2021-09-22 19:42 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-09-22 19:42 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

Hi James,

On 9/22/21 2:34 PM, James Prestwood wrote:
> If the IE's operating class and channel doesn't validate don't bother
> storing the IE at all.
> ---
>   src/scan.c | 16 ++++++++++++----
>   1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/src/scan.c b/src/scan.c
> index 54a7bc84..3f36ea3e 100644
> --- a/src/scan.c
> +++ b/src/scan.c
> @@ -1063,11 +1063,19 @@ static void scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
>   		bss->owe_trans = l_new(struct ie_owe_transition_info, 1);
>   
>   		if (ie_parse_owe_transition(data - 2, len + 2,
> -						bss->owe_trans) < 0) {
> -			l_free(bss->owe_trans);
> -			bss->owe_trans = NULL;
> -		}
> +						bss->owe_trans) < 0)
> +			goto free_owe_trans;
> +
> +		if (bss->owe_trans->oper_class && oci_to_frequency(
> +						bss->owe_trans->oper_class,
> +						bss->owe_trans->channel) < 0)
> +			goto free_owe_trans;
> +
> +		return;
>   
> +free_owe_trans:
> +		l_free(bss->owe_trans);
> +		bss->owe_trans = NULL;
>   		return;

I simplified the logic here slightly through the use of _auto_ and l_steal_ptr.

>   	}
>   
> 

Patches 2-4 applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-22 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-22 19:34 [PATCH v2 2/4] scan: validate OWE transition operating class/channel James Prestwood
  -- strict thread matches above, loose matches on Subject: below --
2021-09-22 19:42 Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox