Avoid invalid memory read in json_pack()
Avoid invalid memory read in json_pack()

Initial patch by @bharjoc-bitdefender

Fixes #421

akheron/jansson,Mephistophiles/jansson,bstarynk/jansson,akheron/jansson,AmesianX/jansson,bstarynk/jansson,bstarynk/jansson,akheron/jansson,markalanj/jansson,markalanj/jansson,Mephistophiles/jansson,AmesianX/jansson,markalanj/jansson