From b5818182a4841460a4b8556a1e0c816c4c5ef2f4 Mon Sep 17 00:00:00 2001 From: CK Tan Date: Wed, 14 Jul 2021 20:20:15 -0700 Subject: [PATCH] fix an overflow bug in the scanner --- toml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toml.c b/toml.c index 5c73773..e495115 100644 --- a/toml.c +++ b/toml.c @@ -1723,7 +1723,7 @@ static int scan_string(context_t* ctx, char* p, int lineno, int dotisspecial) /* check for timestamp without quotes */ if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) { // forward thru the timestamp - for ( ; strchr("0123456789.:+-T Z", toupper(*p)); p++); + for ( ; *p && strchr("0123456789.:+-T Z", toupper(*p)); p++); // squeeze out any spaces at end of string for ( ; p[-1] == ' '; p--); // tokenize