]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
json: fix seg. fault converting NULL to JSON string
authorMartin Belanger <martin.belanger@dell.com>
Thu, 3 Aug 2023 17:15:28 +0000 (13:15 -0400)
committerDaniel Wagner <wagi@monom.org>
Fri, 4 Aug 2023 14:09:28 +0000 (16:09 +0200)
commitfda312dc3aec8bae996f7731ab2f249b8b58d6e6
tree545c133d9afe1181c3c902f6bbfe33a7bbd7a242
parenteb37d2069ce071416f7d478c9a11ab888705ba11
json: fix seg. fault converting NULL to JSON string

The function json_object_new_string() seg. faults when passed a
NULL pointer. This can happen, for example, when parameters retuned
by a controller (e.g. Firmware, Model Number, Serial Number, etc.)
are undefined and therefore NULL. This will cause the following
command to crash:

nvme list -v -o json

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
util/json.h