summaryrefslogtreecommitdiff
path: root/tools/command.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2022-02-07 19:58:04 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2022-02-07 20:02:11 +0100
commitf83b3962c10bf4e196fec0e3e735820ba908661f (patch)
tree7c13caddb8d96b615ec0832a428b4c9d31fd344d /tools/command.c
parent8dccc2314e2482370bc6e5cf007eb210994abdef (diff)
downloadlvm2-f83b3962c10bf4e196fec0e3e735820ba908661f.tar.gz
asan: fix some reports from libasan
When compiled and used with: CFLAGS="-fsanitize=address -g -O0" ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 we have few reported issue - they where not normally spotted, since we were still accessing our own memory - but ouf of buffer-range. TODO: there is still something to enhance with handling of #orphan vgids
Diffstat (limited to 'tools/command.c')
-rw-r--r--tools/command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/command.c b/tools/command.c
index 18ffd64ed..8de8825e4 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -2549,7 +2549,7 @@ static const char *_man_long_opt_name(const char *cmdname, int opt_enum)
}
if (strchr(long_opt, '[')) {
- for (i = 0; i < sizeof(long_opt_name) - 1; ++long_opt, ++i) {
+ for (i = 0; *long_opt && i < sizeof(long_opt_name) - 1; ++long_opt, ++i) {
if (i < (sizeof(long_opt_name) - 8))
switch(*long_opt) {
case '[':