star-cem

Compute the position of the sun
git clone git://git.meso-star.com/star-cem.git
Log | Files | Refs | README | LICENSE

commit b50d446e47335499a487c8b0ed77538165869e10
parent 013e2e967e1e1dd72cb8b369e8bce3cc8799433c
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Thu, 21 May 2026 16:39:56 +0200

Fix date parsing

Trailing chars where not checked for

Diffstat:
Msrc/scem_main.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/scem_main.c b/src/scem_main.c @@ -66,9 +66,11 @@ parse_algo(const char* str, enum scem_sun_algo* algo) static res_T parse_date(const char* str, struct tm* time) { + char *p; ASSERT(str && time); - if(!strptime(str, "%Y-%m-%dT%H:%M:%S\n", time)) { + p = strptime(str, "%Y-%m-%dT%H:%M:%S\n", time); + if(!p || *p != '\0') { /* strptime failed or trailing chars */ return RES_BAD_ARG; } else { return RES_OK;