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 <[email protected]> --- util/help.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/help.c b/util/help.c index 2d57fa1..f867944 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) fails.\n"); + exit(1); + } + + dest = strrchr(new, '/'); /* strlen("konqueror") == strlen("kfmclient") */ strcpy(dest + 1, "kfmclient"); -- 1.8.3.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
