From d5e763e1920eadf0bc0d460abbf686c65db2a3b4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 11 Apr 2011 10:13:15 +0200 Subject: apt_pkg: Raise error when parse_commandline gets empty argv (LP: #707416) --- python/configuration.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'python/configuration.cc') diff --git a/python/configuration.cc b/python/configuration.cc index 93e92efa..b6a44b44 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -438,6 +438,10 @@ PyObject *ParseCommandLine(PyObject *Self,PyObject *Args) return 0; } + if (PySequence_Length(Pargv) < 1) { + PyErr_SetString(PyExc_ValueError,"argv is an empty sequence"); + return 0; + } // Convert the option list int Length = PySequence_Length(POList); CommandLine::Args *OList = new CommandLine::Args[Length+1]; -- cgit v1.2.3