diff options
author | Wenchao Hao <haowenchao@huawei.com> | 2020-11-30 21:34:22 +0800 |
---|---|---|
committer | Wenchao Hao <haowenchao@huawei.com> | 2020-12-12 11:44:22 +0800 |
commit | 873fb12261b8dfa2d4512ce28ad9bc8f48efd66d (patch) | |
tree | 8ab5a70ecffceef9799b3c7edd6fe437de7769b9 | |
parent | b532ad67d495d42026165a26515c645995d23f18 (diff) | |
download | open-iscsi-873fb12261b8dfa2d4512ce28ad9bc8f48efd66d.tar.gz |
fwparam_ppc: Fix NULL pointer dereference in find_devtree()
If strdup() returns NULL, find_devtree() just return NULL to
indicate this function execute failed.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Bo <wubo40@huawei.com>
-rw-r--r-- | utils/fwparam_ibft/fwparam_ppc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/fwparam_ibft/fwparam_ppc.c b/utils/fwparam_ibft/fwparam_ppc.c index b5eaa00..25d4532 100644 --- a/utils/fwparam_ibft/fwparam_ppc.c +++ b/utils/fwparam_ibft/fwparam_ppc.c @@ -76,6 +76,9 @@ static char *find_devtree(const char *filename) * /chosen. */ + if (!devtree) + return NULL; + chop_at = strstr(devtree, "/chosen"); if (!chop_at) chop_at = strstr(devtree, "/aliases"); |