]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix potential null pointer dereference
authorSami Kerola <kerolasa@iki.fi>
Fri, 12 Jul 2019 20:56:52 +0000 (21:56 +0100)
committerSami Kerola <kerolasa@iki.fi>
Fri, 12 Jul 2019 21:09:31 +0000 (22:09 +0100)
This is false positive warning, but lets silence it so that if and when
warnings crop up they are easy to notice and take seriously.

libmount/src/optstr.c:354:29: warning: potential null pointer dereference
[-Wnull-dereference]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
libmount/src/optstr.c

index c0f438fe2e2a77598daaee1d4e98eea33bcdd614..49fc9cc40e6d9fddf72f7f99511760bd22893bd9 100644 (file)
@@ -351,7 +351,9 @@ int mnt_optstr_deduplicate_option(char **optstr, const char *name)
                        end = ol.end;
                        opt = end && *end ? end + 1 : NULL;
                }
-       } while (rc == 0 && opt && *opt);
+               if (opt == NULL)
+                       break;
+       } while (rc == 0 && *opt);
 
        return rc < 0 ? rc : begin ? 0 : 1;
 }