ckuethe / i2c-gps-nav

Automatically exported from code.google.com/p/i2c-gps-nav
1 stars 0 forks source link

arraysize of string is too small #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. if (offset < 15)
                    string[offset++] = c;

the next character received is a '*', or ',' then there is a write outside the 
array boundaries:

case ',':
case '*':
          string[offset] = 0;

Version 22 used.

Either change the array size or if (offset < 15) to if (offset < 14)

Original issue reported on code.google.com by olf...@gmail.com on 18 Jan 2015 at 2:07

kcozens commented 8 years ago

A #define should be used to define the size of the string array. That #define can then be used throughout the rest of the code when doing boundary checks.