Hi,

On Thu, 2013-11-28 at 09:38 +0100, Daniel Wagner wrote:
> From: Daniel Wagner <[email protected]>
> 
> The address of an array is never NULL, so
> the comparison will always evaluate the same way.
> 
> Reported by coverity.
> ---
>  gsupplicant/supplicant.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
> index 438d7f6..31a34c3 100644
> --- a/gsupplicant/supplicant.c
> +++ b/gsupplicant/supplicant.c
> @@ -732,7 +732,7 @@ const void 
> *g_supplicant_interface_get_wps_ssid(GSupplicantInterface *interface,
>       if (!ssid_len)
>               return NULL;
>  
> -     if (!interface || !interface->wps_cred.ssid) {
> +     if (!interface || interface->wps_cred.ssid[0] == '\0') {
>               *ssid_len = 0;
>               return NULL;
>       }

Here one needs to check interface->wps_cred.ssid_len == 0, not the
address.

> @@ -850,7 +850,7 @@ const char 
> *g_supplicant_network_get_security(GSupplicantNetwork *network)
>  const void *g_supplicant_network_get_ssid(GSupplicantNetwork *network,
>                                               unsigned int *ssid_len)
>  {
> -     if (!network || !network->ssid) {
> +     if (!network || network->ssid[0] == '\0') {
>               *ssid_len = 0;
>               return NULL;
>       }

An SSID can contain 0x00 as it's first character, so the current code is
correct. It's an byte array in Agent API and can be specified as a hex
string in the config file.

Cheers,

        Patrik

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to