--- libelwix/src/json.c 2021/03/21 01:32:04 1.9 +++ libelwix/src/json.c 2024/10/26 14:55:56 1.9.34.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: json.c,v 1.9 2021/03/21 01:32:04 misho Exp $ +* $Id: json.c,v 1.9.34.1 2024/10/26 14:55:56 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -427,7 +427,10 @@ json_token2val(const char *jstr, jtok_t * __restrict t return NULL; AIT_SET_STRSIZ(v, json_toklen(tok)); - strncpy(AIT_GET_STR(v), json_tokstr(jstr, tok), AIT_LEN(v) - 1); + if (AIT_GET_STR(v)) + strncpy(AIT_GET_STR(v), json_tokstr(jstr, tok), AIT_LEN(v) - 1); + else + ait_freeVar(&v); return v; }