Hi Lorn,

I just wonder what is the issue that this patch is fixing, isn't the
current implementation working?

On pe, 2014-08-01 at 19:42 +1000, Lorn Potter wrote:
> I found an old patch that crashed, and fixed it up.
> Enjoy!
> 
> ---
>   gsupplicant/supplicant.c |   20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
> index 534944b..19dbb1a 100644
> --- a/gsupplicant/supplicant.c
> +++ b/gsupplicant/supplicant.c
> @@ -1256,6 +1256,26 @@ static void 
> interface_network_removed(DBusMessageIter *iter, void *user_data)
> 
>   static char *create_name(unsigned char *ssid, int ssid_len)
>   {
> +       SUPPLICANT_DBG("%s, %i", ssid, ssid_len)
> +
> +       gchar *result;
> +       GError *error = 0;
> +       gsize bytes_written = 0;
> +
> +       if (g_utf8_validate((const char *)ssid, ssid_len, NULL) == TRUE)
> +               return g_strndup((const char *)ssid, ssid_len);
> +
> +       result = g_convert_with_fallback((const char *)ssid, -1,
> +                                       "UTF-8", "ISO-8859-1",
> +                                       0, 0,
> +                                       &bytes_written, &error);

SSID's are just byte arrays, how can we know which codeset we are
converting from (you assume ISO-8859-1 here)?


> +       if (result) {
> +               return result;
> +       } else {
> +               SUPPLICANT_DBG("Error converting to UTF-8: %s", 
> error->message);
> +               g_error_free (error);
> +       }
> +
>          GString *string;
>          const gchar *remainder, *invalid;
>          int valid_bytes, remaining_bytes;

C++ style code here, the variables should be declared at the beginning
of func.


Cheers,
Jukka


_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to