Skip to content

Commit

Permalink
Initialize dmac array to nulls
Browse files Browse the repository at this point in the history
I don't fully understand why, but I've seen segfaults when the dmac value isn't initialized to 0s.
  • Loading branch information
jp-bennett authored Dec 9, 2024
1 parent f3850ee commit d8c9434
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platform/portduino/PortduinoGlue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void portduinoSetup()
}
}

uint8_t dmac[6];
uint8_t dmac[6] = {0};
getMacAddr(dmac);
if (dmac[0] == 0 && dmac[1] == 0 && dmac[2] == 0 && dmac[3] == 0 && dmac[4] == 0 && dmac[5] == 0) {
std::cout << "*** Blank MAC Address not allowed!" << std::endl;
Expand Down Expand Up @@ -531,4 +531,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac)
} else {
return false;
}
}
}

0 comments on commit d8c9434

Please sign in to comment.