Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH] knownnetworks: sanitize known_network.freq on load
Date: Fri, 29 Jan 2021 15:07:57 -0800	[thread overview]
Message-ID: <20210129230757.126357-1-prestwoj@gmail.com> (raw)

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

An invalid known_network.freq file containing several UUID
groups which have the same 'name' key results in memory leaks
in IWD. This is because the file is loaded and the group's
are iterated without detecting duplicates. This leads to the
same network_info's known_frequencies being set/overridden
multiple times.

To fix this we just check if the network_info already has a
UUID set. If so remove the stale entry.
---
 src/knownnetworks.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 53cfc30f..32beae84 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -916,6 +916,11 @@ static int known_network_frequencies_load(void)
 		if (!info)
 			continue;
 
+		if (info->has_uuid) {
+			l_settings_remove_group(known_freqs, groups[i]);
+			continue;
+		}
+
 		freq_list = l_settings_get_string(known_freqs, groups[i],
 							"list");
 		if (!freq_list)
-- 
2.26.2

             reply	other threads:[~2021-01-29 23:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 23:07 James Prestwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-29 21:35 [PATCH] knownnetworks: sanitize known_network.freq on load James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210129230757.126357-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox