From: Karel Zak Date: Mon, 30 Jan 2012 22:22:53 +0000 (+0100) Subject: libmount: fix possible null dereferencing [coverity scan] X-Git-Tag: v2.21-rc2~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff7eba4d5ed28ca1f9b9288f1e292c7e7bf49937;p=thirdparty%2Futil-linux.git libmount: fix possible null dereferencing [coverity scan] ... let's keep Coverity analyzer happy. Signed-off-by: Karel Zak --- 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); }