* [PATCH 1/2] eap-ttls: Address mem leak reported by coverity
@ 2019-10-15 17:34 Tim Kourt
2019-10-15 17:34 ` [PATCH 2/2] client: Address dbl free " Tim Kourt
2019-10-16 20:50 ` [PATCH 1/2] eap-ttls: Address mem leak " Denis Kenzior
0 siblings, 2 replies; 3+ messages in thread
From: Tim Kourt @ 2019-10-15 17:34 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 878 bytes --]
The issue has appeared in 6017dc573
---
src/eap-ttls.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/eap-ttls.c b/src/eap-ttls.c
index 00559cb7..619c7efa 100644
--- a/src/eap-ttls.c
+++ b/src/eap-ttls.c
@@ -1089,7 +1089,7 @@ static bool eap_ttls_settings_load(struct eap_state *eap,
struct l_settings *settings,
const char *prefix)
{
- struct phase2_method *phase2 = l_new(struct phase2_method, 1);
+ struct phase2_method *phase2;
const char *phase2_method_name;
char setting[72];
uint8_t i;
@@ -1100,6 +1100,8 @@ static bool eap_ttls_settings_load(struct eap_state *eap,
if (!phase2_method_name)
return false;
+ phase2 = l_new(struct phase2_method, 1);
+
snprintf(setting, sizeof(setting), "%sTTLS-Phase2-", prefix);
for (i = 0; tunneled_non_eap_method_ops[i].name; i++) {
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] client: Address dbl free reported by coverity
2019-10-15 17:34 [PATCH 1/2] eap-ttls: Address mem leak reported by coverity Tim Kourt
@ 2019-10-15 17:34 ` Tim Kourt
2019-10-16 20:50 ` [PATCH 1/2] eap-ttls: Address mem leak " Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Tim Kourt @ 2019-10-15 17:34 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]
In practice, the double free isn't possible in this logic.
It also simplifies the print logic
---
client/station.c | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/client/station.c b/client/station.c
index a332f486..a89c9833 100644
--- a/client/station.c
+++ b/client/station.c
@@ -338,7 +338,6 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
{
char *dbms = NULL;
const struct l_queue_entry *entry;
- bool is_first;
display_table_header("Available networks", "%s%-*s%-*s%-*s%*s",
MARGIN, 2, "", 32, "Network name",
@@ -351,7 +350,7 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
return;
}
- for (is_first = true, entry = l_queue_get_entries(ordered_networks);
+ for (entry = l_queue_get_entries(ordered_networks);
entry; entry = entry->next) {
struct ordered_network *network = entry->data;
const struct proxy_interface *network_i =
@@ -362,24 +361,17 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
if (display_signal_as_dbms)
dbms = l_strdup_printf("%d", network->signal_strength);
- if (is_first && network_is_connected(network_i)) {
- display("%s%-*s%-*s%-*s%-*s\n", MARGIN,
- 2, COLOR_BOLDGRAY "> " COLOR_OFF,
- 32, network_name, 10, network_type,
- 6, display_signal_as_dbms ? dbms :
- dbms_tostars(network->signal_strength));
+ display("%s%-*s%-*s%-*s%-*s\n", MARGIN, 2,
+ network_is_connected(network_i) ?
+ COLOR_BOLDGRAY "> " COLOR_OFF : "",
+ 32, network_name, 10, network_type,
+ 6, display_signal_as_dbms ? dbms :
+ dbms_tostars(network->signal_strength));
+ if (display_signal_as_dbms) {
l_free(dbms);
- is_first = false;
- continue;
+ dbms = NULL;
}
-
- display("%s%-*s%-*s%-*s%-*s\n", MARGIN, 2, "",
- 32, network_name, 10, network_type,
- 6, display_signal_as_dbms ? dbms :
- dbms_tostars(network->signal_strength));
-
- l_free(dbms);
}
display_table_footer();
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] eap-ttls: Address mem leak reported by coverity
2019-10-15 17:34 [PATCH 1/2] eap-ttls: Address mem leak reported by coverity Tim Kourt
2019-10-15 17:34 ` [PATCH 2/2] client: Address dbl free " Tim Kourt
@ 2019-10-16 20:50 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2019-10-16 20:50 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 227 bytes --]
Hi Tim,
On 10/15/19 12:34 PM, Tim Kourt wrote:
> The issue has appeared in 6017dc573
> ---
> src/eap-ttls.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Both applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-16 20:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-15 17:34 [PATCH 1/2] eap-ttls: Address mem leak reported by coverity Tim Kourt
2019-10-15 17:34 ` [PATCH 2/2] client: Address dbl free " Tim Kourt
2019-10-16 20:50 ` [PATCH 1/2] eap-ttls: Address mem leak " Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox