From ff7eba4d5ed28ca1f9b9288f1e292c7e7bf49937 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 30 Jan 2012 23:22:53 +0100 Subject: [PATCH] libmount: fix possible null dereferencing [coverity scan] ... let's keep Coverity analyzer happy. Signed-off-by: Karel Zak --- libmount/src/context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmount/src/context.c b/libmount/src/context.c index 4494ac6c1e..2d88dc38e8 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -1348,7 +1348,9 @@ int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name, rc = stat(helper, &st); if (rc == -1 && errno == ENOENT && strchr(type, '.')) { /* If type ends with ".subtype" try without it */ - *strrchr(helper, '.') = '\0'; + char *hs = strrchr(helper, '.'); + if (hs) + *hs = '\0'; rc = stat(helper, &st); } -- 2.47.3