Skip to content

Commit 9029d7d

Browse files
authored
Merge pull request #317 from arduino/fix-buffer-overflow
Fix buffer-overflow assigning global Wire instances.
2 parents fe72ebf + 68f924b commit 9029d7d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: libraries/Wire/Wire.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ extern "C" {
3030

3131
#include "Wire.h"
3232

33-
TwoWire *TwoWire::g_SCIWires[TWOWIRE_MAX_I2C_CHANNELS] = {nullptr};
34-
TwoWire *TwoWire::g_I2CWires[TWOWIRE_MAX_SCI_CHANNELS] = {nullptr};
33+
TwoWire *TwoWire::g_SCIWires[TWOWIRE_MAX_SCI_CHANNELS] = {nullptr};
34+
TwoWire *TwoWire::g_I2CWires[TWOWIRE_MAX_I2C_CHANNELS] = {nullptr};
3535

3636
/* -------------------------------------------------------------------------- */
3737
void TwoWire::setBusStatus(WireStatus_t ws) {

Diff for: libraries/Wire/Wire.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ class TwoWire : public arduino::HardwareI2C {
152152

153153
private:
154154

155-
static TwoWire *g_SCIWires[TWOWIRE_MAX_I2C_CHANNELS];
156-
static TwoWire *g_I2CWires[TWOWIRE_MAX_SCI_CHANNELS];
155+
static TwoWire *g_SCIWires[TWOWIRE_MAX_SCI_CHANNELS];
156+
static TwoWire *g_I2CWires[TWOWIRE_MAX_I2C_CHANNELS];
157157

158158
static void WireSCIMasterCallback(i2c_master_callback_args_t *);
159159
static void WireMasterCallback(i2c_master_callback_args_t *);

0 commit comments

Comments
 (0)