Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
ndctl
ndctl-util-help-check-whether-strdup-returns-NU...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ndctl-util-help-check-whether-strdup-returns-NULL-in-exec_.patch of Package ndctl
From c87138c3b36824d379c12b64a77c3e235d35b6f1 Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu <liuzhiqiang26@huawei.com> Date: Fri, 6 Nov 2020 17:26:38 +0800 Subject: [PATCH] util/help: check whether strdup returns NULL in exec_man_konqueror References: bsc#1170384 Patch-mainline: v71 Git-commit: c87138c3b36824d379c12b64a77c3e235d35b6f1 In exec_man_konqueror(), new is allocated by calling strdup(), which may return NULL. We should check whether new is NULL before using it. Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> Link: https://lore.kernel.org/r/889d3dc7-2532-9f91-b0d8-5eeab45d6bb7@huawei.com --- util/help.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/help.c b/util/help.c index 2d57fa17791c..05fc218ae6cd 100644 --- a/util/help.c +++ b/util/help.c @@ -44,8 +44,14 @@ static void exec_man_konqueror(const char *path, const char *page) if (path) { const char *file = strrchr(path, '/'); if (file && !strcmp(file + 1, "konqueror")) { + char *dest; char *new = strdup(path); - char *dest = strrchr(new, '/'); + if (!new) { + pr_err("strdup(path) failed.\n"); + exit(1); + } + + dest = strrchr(new, '/'); /* strlen("konqueror") == strlen("kfmclient") */ strcpy(dest + 1, "kfmclient"); -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor