ssid with double space not stored correctly

Dale R. Worley worley at
Wed Dec 13 04:33:54 PST 2017

Erich Titl <erich.titl at> writes:
> SALT# wpa_cli set_network 23 ssid \"NOS-CAFE DA  MARINA\"
> Selected interface 'wlan0'
> OK

I'm just a lurker here, but if SSIDs can contain spaces (I never
realized that!), then *all* the programs have to be hardened to deal
with spaces in SSIDs correctly.  It's not too difficult if you pay close
attention, but it's easy to overlook.

For instance, one "correct" command line would be

# wpa_cli set_network 23 ssid 'NOS-CAFE DA  MARINA'

This is also correct:

# wpa_cli set_network 23 ssid "NOS-CAFE DA  MARINA"

In both cases, the 4th argument to the wpa_cli program is the string
"NOS-CAFE DA  MARINA" (19 characters).

This command:

# wpa_cli set_network 23 ssid \"NOS-CAFE DA  MARINA\"

would be expected to produce freaky results, since the 4th argument to
wpa_cli is the string '"NOS-CAFE' (8 chars), the 5th is 'DA' (2 chars),
and the 6th is 'MARINA"' (7 chars), since the spaces between the words
aren't quotes (since the double-quotes are quoted, they do not make a
quoted tring).

Where it gets tricky is if one of the programs involved is a shell
script; then you have to take special care to always quote the SSID when
it's mentioned.

Taking a brief look, wpa_cli seems to be a binary executable, so it
shouldn't be needing to take special care about spaces, it probably does
the right thing automatically.  But other programs in the suite may have


More information about the Hostap mailing list