1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 19:52:09 +01:00

Fixed possible invalid memory access

This commit is contained in:
Martin Tůma 2016-11-23 18:44:22 +01:00
parent 2bdab0f449
commit 1242423ca8

View File

@ -7,10 +7,10 @@ static bool validSentence(const char *line, int len)
{
const char *lp;
if (len < 10 || line[0] != '$')
if (len < 12 || line[0] != '$')
return false;
for (lp = line + len - 1; lp > line; lp--)
for (lp = line + len - 1; lp > line + 3; lp--)
if (!::isspace(*lp))
break;
if (*(lp-2) != '*' || !::isalnum(*(lp-1)) || !::isalnum(*(lp)))