diff options
author | iain <iain@sleepfive.com> | 2012-05-14 15:16:22 +0100 |
---|---|---|
committer | iain <iain@sleepfive.com> | 2012-05-14 15:16:22 +0100 |
commit | 0080341a83c140670cbf4a677a98831c5e6e3e2c (patch) | |
tree | f370ecb2ec23135167d93e391727b2cb4202e4fa | |
parent | 563716fc596d53f1085949a9dd11a62f39b2d624 (diff) |
Check the chars in buffer doesn't go over the max. Reset it if it does.
-rw-r--r-- | src/gypsy-nmea-parser.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gypsy-nmea-parser.c b/src/gypsy-nmea-parser.c index d8e3195..b4d27ad 100644 --- a/src/gypsy-nmea-parser.c +++ b/src/gypsy-nmea-parser.c @@ -147,6 +147,10 @@ gypsy_nmea_parser_get_buffer (GypsyParser *parser, GypsyNmeaParser *nmea = GYPSY_NMEA_PARSER (parser); GypsyNmeaParserPrivate *priv = nmea->priv; + if (priv->chars_in_buffer >= READ_BUFFER_SIZE) { + priv->chars_in_buffer = 0; + } + *buffer = (priv->buffer + priv->chars_in_buffer); return READ_BUFFER_SIZE - priv->chars_in_buffer; } |