NetworkManager/clients/common
Thomas Haller 4f5cd076ab
libnmc-base:fix leak in NMSecretAgentSimple's request_secrets_from_ui()
Found by Coverity:

  Error: RESOURCE_LEAK (CWE-772): [#def271] [important]
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:874: alloc_fn: Storage is returned from allocation function "nm_utils_ssid_to_utf8".
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:874: var_assign: Assigning: "ssid_utf8" = storage returned from "nm_utils_ssid_to_utf8(g_bytes_get_data(ssid, NULL), g_bytes_get_size(ssid))".
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:877: noescape: Resource "ssid_utf8" is not freed or pointed-to in "g_strdup_printf".
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:882: leaked_storage: Variable "ssid_utf8" going out of scope leaks the storage it points to.
  #  880|
  #  881|           if (!add_wireless_secrets(request, secrets))
  #  882|->             goto out_fail;
  #  883|       } else if (nm_connection_is_type(request->connection, NM_SETTING_WIRED_SETTING_NAME)) {
  #  884|           title = _("Wired 802.1X authentication");

  Error: RESOURCE_LEAK (CWE-772): [#def272] [important]
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:874: alloc_fn: Storage is returned from allocation function "nm_utils_ssid_to_utf8".
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:874: var_assign: Assigning: "ssid_utf8" = storage returned from "nm_utils_ssid_to_utf8(g_bytes_get_data(ssid, NULL), g_bytes_get_size(ssid))".
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:877: noescape: Resource "ssid_utf8" is not freed or pointed-to in "g_strdup_printf".
  NetworkManager-1.31.3/src/libnmc-base/nm-secret-agent-simple.c:883: leaked_storage: Variable "ssid_utf8" going out of scope leaks the storage it points to.
  #  881|           if (!add_wireless_secrets(request, secrets))
  #  882|               goto out_fail;
  #  883|->     } else if (nm_connection_is_type(request->connection, NM_SETTING_WIRED_SETTING_NAME)) {
  #  884|           title = _("Wired 802.1X authentication");
  #  885|           msg   = g_strdup_printf(_("Secrets are required to access the wired network %s"),

Fixes: 3fbabde4c3 ('libnm-core: replace GByteArray with pointer + length in some APIs')
(cherry picked from commit 2c628e4762)
2021-06-04 21:22:08 +02:00
..
tests all: add "libnm/nm-default-client.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
meson.build all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-client-utils.c all: add "libnm/nm-default-client.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
nm-client-utils.h all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-meta-setting-access.c all: add "libnm/nm-default-client.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
nm-meta-setting-access.h all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-meta-setting-base-impl.c all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-meta-setting-base-impl.h all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-meta-setting-base.h all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-meta-setting-desc.c cli: fix RETURN_STR_EMPTYUNSET() macro for printing handle_emptyunset string 2021-06-04 20:21:52 +02:00
nm-meta-setting-desc.h all: move shared/nm-meta-setting.[hc] to libnm-core and clients 2021-02-09 12:38:19 +01:00
nm-polkit-listener.c build: make path to polkit-agent-helper-1 binary configurable 2021-02-12 11:36:36 +01:00
nm-polkit-listener.h all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-secret-agent-simple.c libnmc-base:fix leak in NMSecretAgentSimple's request_secrets_from_ui() 2021-06-04 21:22:08 +02:00
nm-secret-agent-simple.h all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-vpn-helpers.c all: add "libnm/nm-default-client.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
nm-vpn-helpers.h all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
qrcodegen.c all: reformat all with new clang-format style 2020-09-28 16:07:51 +02:00
qrcodegen.h all: reformat all with new clang-format style 2020-09-28 16:07:51 +02:00
settings-docs.h.in setting-8021x: Fix descriptions for phase2-auth & phase2-autheap 2021-02-09 17:09:31 +01:00
settings-docs.xsl cli: fix marking settings docs for translation 2017-04-23 23:45:02 +02:00