aports/main/smartmontools/fix-segfault-in-option-handling.patch

14 lines
639 B
Diff

upstream: https://www.smartmontools.org/ticket/1830#comment:1
diff --git a/smartctl.cpp b/smartctl.cpp
index da97640..41a6e0a 100644
--- a/smartctl.cpp
+++ b/smartctl.cpp
@@ -1168,7 +1168,7 @@ static int parse_options(int argc, char** argv, const char * & type,
printing_is_off = false;
printslogan();
// Point arg to the argument in which this option was found.
- arg = argv[optind-1];
+ arg = argv[optind-2];
// Check whether the option is a long option that doesn't map to -h.
if (arg[1] == '-' && optchar != 'h') {
// Iff optopt holds a valid option then argument must be missing.