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

Sign up
Appearance settings

Commit 3122511

Browse files
Added bounds checking on pinMode
1 parent c8d6aef commit 3122511

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎cores/arduino/wiring_digital.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
void pinMode(uint8_t pin, uint8_t mode)
3030
{
31+
//prevent reading beyond end of arrays:
32+
if (pin > sizeof(digital_pin_to_port_PGM) / sizeof(digital_pin_to_port_PGM[0])) return;
33+
3134
uint8_t bit = digitalPinToBitMask(pin);
3235
uint8_t port = digitalPinToPort(pin);
3336
volatile uint8_t *reg, *out;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /