aboutsummaryrefslogtreecommitdiff
path: root/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2014-04-24 22:57:27 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2014-09-10 13:42:06 +0200
commitfde95cf5b5ace06f497842f9329d5207c4834898 (patch)
treeb70c5cca781391152bc24796e866e215588bf8c1 /libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
parent35a84769d4dbc0670550ea2abde83bd33dc28729 (diff)
Fix off-by-one in String::substring
When checking the `left` argument, it previously allowed having left == len. However, this means the substring starts one past the last character in the string and should return the empty string. In practice, this already worked correctly, because buffer[len] contains the trailing nul, so it would (re)assign the empty string to `out`. However, fixing this check makes it a bit more logical, and prevents a fairly unlikely out-of-buffer write (to address 0x0) when calling substring on an invalidated String: String bar = (char*)NULL; bar.substring(0, 0);
Diffstat (limited to 'libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino')
0 files changed, 0 insertions, 0 deletions