Skip to content

Commit f63d5aa

Browse files
authored
Merge pull request #20 from lillefyr/master
Prevent buffer overflow in retransmission. Improve WiFi begin connection
2 parents f0af016 + b725d22 commit f63d5aa

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Fossa_GroundStation/Fossa_GroundStation.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,12 +1290,12 @@ void requestPacketInfo() {
12901290

12911291
void requestRetransmit() {
12921292
Serial.println(F("Enter message to be sent:"));
1293-
Serial.println(F("(max 32 characters, end with LF or CR+LF)"));
1293+
Serial.println(F("(max 30 characters, end with LF or CR+LF)"));
12941294

12951295
// get data to be retransmited
12961296
char optData[32];
12971297
uint8_t bufferPos = 0;
1298-
while(bufferPos < 32) {
1298+
while(bufferPos < 31) {
12991299
while(!Serial.available());
13001300
char c = Serial.read();
13011301
Serial.print(c);

src/Fossa_GroundStation/config_manager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ bool Config_managerClass::begin(bool invalidate_config)
3535
ESP_LOGI (WIFIMAN_TAG, "Configuration loaded from flash");
3636
if (invalidate_config)
3737
WiFi.begin ("0"); // Reset Wifi credentials
38-
else
38+
else{
39+
WiFi.enableSTA(true);
3940
WiFi.begin (board_config->ssid, board_config->pass);
41+
}
4042
unsigned long start_connect = millis ();
41-
while (millis () - start_connect > WIFI_CONNECT_TIMEOUT) {
43+
while (millis () - start_connect < WIFI_CONNECT_TIMEOUT) {
4244
Serial.print ('.');
4345
delay (250);
4446
}

0 commit comments

Comments
 (0)