diff --git a/src/dot11/dot11_mgmt.cpp b/src/dot11/dot11_mgmt.cpp index ba05254..fc558ab 100644 --- a/src/dot11/dot11_mgmt.cpp +++ b/src/dot11/dot11_mgmt.cpp @@ -383,12 +383,7 @@ string Dot11ManagementFrame::ssid() const { if (!option) { throw option_not_found(); } - if (option->data_size() == 0 && subtype() == Dot11::PROBE_REQ){ - return "BROADCAST"; - } - else { - return string((const char*)option->data_ptr(), option->data_size()); - } + return option->to(); } Dot11ManagementFrame::rates_type Dot11ManagementFrame::supported_rates() const { diff --git a/tests/src/dot11/beacon.cpp b/tests/src/dot11/beacon.cpp index 0ca8dd7..229b3eb 100644 --- a/tests/src/dot11/beacon.cpp +++ b/tests/src/dot11/beacon.cpp @@ -134,6 +134,12 @@ TEST_F(Dot11BeaconTest, SSID) { EXPECT_EQ(dot11.ssid(), "libtins"); } +TEST_F(Dot11BeaconTest, EmptySSID) { + Dot11Beacon dot11; + dot11.ssid(""); + EXPECT_EQ(dot11.ssid(), ""); +} + TEST_F(Dot11BeaconTest, SupportedRates) { Dot11Beacon dot11; Dot11Beacon::rates_type rates, found_rates;