diff options
| author | Julian Andres Klode <jak@debian.org> | 2012-06-17 18:03:41 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2012-06-17 18:03:41 +0200 |
| commit | 9b108070aca5121523a74e744bce183f5cdbcb0f (patch) | |
| tree | 0d4e5f74e5205f2a4b362ef788d359d612c89f86 | |
| parent | 6c96502e58b7947084456554fb0aac75ffd9288d (diff) | |
| download | python-apt-9b108070aca5121523a74e744bce183f5cdbcb0f.tar.gz | |
* python/configuration.cc:
- Handle the use of "del" on configuration values. Those are represented
by calling the setter with NULL, which we did not handle before, causing
a segmentation fault (Closes: #661062)
| -rw-r--r-- | debian/changelog | 4 | ||||
| -rw-r--r-- | python/configuration.cc | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 5ba5fbe5..52fed82b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -41,6 +41,10 @@ python-apt (0.8.5) UNRELEASED; urgency=low document this in the RST documentation (Closes: #656288) * debian/control: - Drop Recommends on python2.6 (Closes: #645970) + * python/configuration.cc: + - Handle the use of "del" on configuration values. Those are represented + by calling the setter with NULL, which we did not handle before, causing + a segmentation fault (Closes: #661062) -- Michael Vogt <mvo@debian.org> Tue, 17 Apr 2012 14:09:24 +0200 diff --git a/python/configuration.cc b/python/configuration.cc index 3e634901..37374625 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -331,13 +331,16 @@ static PyObject *CnfMap(PyObject *Self,PyObject *Arg) // Assignment with operator [] static int CnfMapSet(PyObject *Self,PyObject *Arg,PyObject *Val) { - if (PyString_Check(Arg) == 0 || PyString_Check(Val) == 0) + if (PyString_Check(Arg) == 0 || (Val != NULL && PyString_Check(Val) == 0)) { PyErr_SetNone(PyExc_TypeError); return -1; } - GetSelf(Self).Set(PyString_AsString(Arg),PyString_AsString(Val)); + if (Val == NULL) + GetSelf(Self).Clear(PyString_AsString(Arg)); + else + GetSelf(Self).Set(PyString_AsString(Arg),PyString_AsString(Val)); return 0; } /*}}}*/ |
