lept_set_string(): memcpy exists potential undefined behavior

Author: imdouyuCreated Oct 15, 2021Updated Dec 26, 2023

When s == NULL and len == 0, we try copy s to v->u.s.s that is undefined behavior.

The behavior is undefined if either dest or src is an invalid or null pointer.

https://github.com/miloyip/json-tutorial/blob/65c078b2bb270bfc9af50497cd1844bcff5c8214/tutorial03/leptjson.c#L183-L191 We can solve this by add if (s != NULL) before memcpy.