Commit 0dc339a
tree: Fix potential NULL pointer dereference in nvme_host_get_ids()
The nvme_host_get_hostid() and nvme_host_get_hostnqn() functions can
return NULL when the host configuration is incomplete or invalid. Using
strdup() directly on these return values causes a segmentation fault
when NULL is passed to strdup().
Replace strdup() calls with xstrdup() to safely handle NULL input
values.
Signed-off-by: Stephen Cheng <[email protected]>1 parent 91cc3ee commit 0dc339a
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
0 commit comments