summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDaniel Hartwig <mandyke@gmail.com>2012-06-09 22:49:37 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-06-09 22:49:37 +0200
commitae2be086c6996e6ed02b7d828fdcac38248a964d (patch)
treefce29714ff989342e99ccebd9a49fc01efd91e67 /apt-pkg
parentab59c1ca30640b90bb657d08b2c219bbaeb65783 (diff)
* apt-pkg/contrib/cmdline.cc:
- apply patch from Daniel Hartwig to fix a segfault in case the LongOpt is empty (Closes: #676331)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/cmndline.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index 159f330a1..b8c7f7984 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -92,8 +92,9 @@ bool CommandLine::Parse(int argc,const char **argv)
// Match up to a = against the list
Args *A;
const char *OptEnd = strchrnul(Opt, '=');
- for (A = ArgList; A->end() == false &&
- stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++);
+ for (A = ArgList; A->end() == false &&
+ (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0);
+ ++A);
// Failed, look for a word after the first - (no-foo)
bool PreceedMatch = false;