diff options
author | Thomas Haller <thaller@redhat.com> | 2014-08-25 12:05:13 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-08-25 12:29:45 +0200 |
commit | faec7674c71d63b353ff85980bf195b36d88573b (patch) | |
tree | deee2c447057f60e1236ebab04693717ca877aea | |
parent | d4cb7e31ea7e4d8a5a395ebc16d16b63dfb34653 (diff) | |
download | NetworkManager-th/printf.tar.gz |
core: escape percent characters for printf format stringth/printf
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 7 | ||||
-rw-r--r-- | src/devices/wimax/nm-device-wimax.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 58ff2ab306..4954c75833 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -39,6 +39,7 @@ #include "nm-device-wifi.h" #include "nm-device-private.h" #include "nm-utils.h" +#include "nm-core-internal.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" #include "nm-activation-request.h" @@ -981,7 +982,7 @@ complete_connection (NMDevice *device, NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; const GByteArray *setting_mac; - char *format, *str_ssid = NULL; + char *format, *str_ssid = NULL, *str_ssid_escaped = NULL; NMAccessPoint *ap = NULL; const GByteArray *ssid = NULL; GSList *iter; @@ -1103,7 +1104,9 @@ complete_connection (NMDevice *device, g_assert (ssid); str_ssid = nm_utils_ssid_to_utf8 (ssid); - format = g_strdup_printf ("%s %%d", str_ssid); + format = g_strdup_printf ("%s %%d", + _nm_utils_str_printf_escape (str_ssid, &str_ssid_escaped)); + g_free (str_ssid_escaped); nm_utils_complete_generic (connection, NM_SETTING_WIRELESS_SETTING_NAME, diff --git a/src/devices/wimax/nm-device-wimax.c b/src/devices/wimax/nm-device-wimax.c index fad1bb5401..511b4f3851 100644 --- a/src/devices/wimax/nm-device-wimax.c +++ b/src/devices/wimax/nm-device-wimax.c @@ -31,6 +31,7 @@ #include "nm-device-wimax.h" #include "nm-wimax-util.h" #include "nm-logging.h" +#include "nm-core-internal.h" #include "nm-device-private.h" #include "NetworkManagerUtils.h" #include "nm-active-connection.h" @@ -373,7 +374,7 @@ complete_connection (NMDevice *device, NMSettingWimax *s_wimax; const GByteArray *setting_mac; const char *hw_address; - char *format; + char *format, *nsp_name_escaped = NULL; const char *nsp_name = NULL; NMWimaxNsp *nsp = NULL; GSList *iter; @@ -438,7 +439,10 @@ complete_connection (NMDevice *device, } g_assert (nsp_name); - format = g_strdup_printf ("%s %%d", nsp_name); + format = g_strdup_printf ("%s %%d", + _nm_utils_str_printf_escape (nsp_name, &nsp_name_escaped)); + g_free (nsp_name_escaped); + nm_utils_complete_generic (connection, NM_SETTING_WIMAX_SETTING_NAME, existing_connections, |