]> www.infradead.org Git - users/sagi/libnvme.git/commit
linux: avoid segfault in check-tls-key due to null hostnqn/subsysnqn
authorMartin George <marting@netapp.com>
Thu, 11 Jan 2024 09:31:22 +0000 (15:01 +0530)
committerDaniel Wagner <wagi@monom.org>
Thu, 18 Jan 2024 13:36:38 +0000 (14:36 +0100)
commitf46b064e57d2c090166c3d934ed2e4b4e31f0042
tree9ad751e7e66bcb2c6edf7b336a5fd15f3bc94d10
parent11d0a894c4a4fe0c129814fd770b1bc80aed9388
linux: avoid segfault in check-tls-key due to null hostnqn/subsysnqn

Running nvme check-tls-key hits a segfault as seen below:

nvme check-tls-key
-d NVMeTLSkey-1:01:bB7soUnpHfxVg53sCY21KY3nLbqLit2RcIO8Rbdf3mKhcKaM:

Segmentation fault (core dumped)

This is because the strlen check on subsysnqn or hostnqn crashes at
src/nvme/linux.c due to either of them being null. Avoid this segfault
by checking these strings before running a strlen on them.

Signed-off-by: Martin George <marting@netapp.com>
src/nvme/linux.c