arduino-libraries / WiFi

WiFi Library for Arduino
http://arduino.cc/
115 stars 58 forks source link

Unused password in "WiFiUdpSendReceiveString" example #59

Open kajnorman opened 1 year ago

kajnorman commented 1 year ago

https://github.com/arduino-libraries/WiFi/blob/e9a39701a6b1b82a466f4e6e909a67b526e9e63c/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino#L56

should be:

status = WiFi.begin(ssid, pass);

Although the code is valid for an open access point, the presence of this line in the sketch clearly indicates the sketch was intended for use with a WPA encrypted access point:

https://github.com/arduino-libraries/WiFi/blob/e9a39701a6b1b82a466f4e6e909a67b526e9e63c/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino#L22

The user will be confused to find the board is unable to connect to the access point even though they set the correct password.

kajnorman commented 1 year ago

Ahh! I see. It is not an error.. not even a minor error ;-) .

per1234 commented 1 year ago

Hi @kajnorman. Thanks for your report. Even though the code is valid, I still think this should be considered a bug so I will reopen it.

Unused code is always a bug and in this case it is especially harmful because the user will be led to believe they can set the password via the pass variable, when that variable is actually not serving any purpose at all.

So the resolution should be either:

A pull request for either of those fixes would be welcome.

kajnorman commented 1 year ago

Thx per1234

I totally agree with you.

Thx for the nice library

And thx for fixin the “issue”