Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

WiFi passwords containing a double quote, comma, or backslash are not escaped correctly when sent to the WiFi USB bridge #430

Copy link
Copy link
Open
@gkjfdh

Description

@gkjfdh
Issue body actions

When serializing command arguments, the software that communicates the WiFi password to the WiFi USB bridge doesn't escape these three special characters that the firmware on the other side interprets. As a result, that firmware mis-parses passwords that contain them and fails to connect.

Sample code, which never successfully connects:

#include <WiFiS3.h>

// #include "Modem.h"

void setup() {
  Serial.begin(9600);

  Serial.println("Starting wifi");
  
  // modem.begin();
  // modem.debug(Serial, 2);

  int status = WL_IDLE_STATUS;
  while(status != WL_CONNECTED) {
    status = WiFi.begin("my_ssid", "goofy\"password");
    Serial.print("status = ");
    Serial.println(status);
    delay(2000);
  }

  Serial.println("Connected!");
  while(1);
}

void loop() {
  // put your main code here, to run repeatedly:
}

SSID and password serialized out with no escaping here: https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/WiFiS3/src/WiFi.cpp#L55

Relevant debugging output from the modem class (thanks to whoever put that in there!):

REQUEST: AT+BEGINSTA=my_ssid,goofy"password

Parser code in the firmware that's interpreting the double quote: https://github.com/arduino/uno-r4-wifi-usb-bridge/blob/07981fbdd01f66de5891d74793b4f2c731be16f7/UNOR4USBBridge/parser.cpp#L161

It's possible to work around this by adding extra escaping in the string in the sketch, e.g.

status = WiFi.begin("my_ssid", "goofy\\\"password");

Which results in this going over the wire, successfully connecting.

REQUEST: AT+BEGINSTA=my_ssid,goofy\"password

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselfRelated to content of the project itselftype: imperfectionPerceived defect in any part of projectPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.