summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-07-04 19:53:47 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2008-07-04 19:53:47 +0200
commitccf689a426760a69b77394abbcddf7897cbd6488 (patch)
tree2756e67e713b1463a66ca1b7b8c1e0f966ac0e23
parent65871e1fea624ad7c78001cf0e0c3e8bc7352283 (diff)
downloadpython-apt-ccf689a426760a69b77394abbcddf7897cbd6488.tar.gz
* python/apt_pkgmodule.cc:
- fix bug in hashsum calculation when the original string contains \0 charackters (thanks to Celso Providelo and Ryan Hass for the test-case) LP: #243630
-rw-r--r--debian/changelog9
-rw-r--r--po/python-apt.pot2
-rw-r--r--python/apt_pkgmodule.cc14
3 files changed, 21 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index 6fa68d7e..8d54596a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+python-apt (0.7.7) unstable; urgency=low
+
+ * python/apt_pkgmodule.cc:
+ - fix bug in hashsum calculation when the original string
+ contains \0 charackters (thanks to Celso Providelo and
+ Ryan Hass for the test-case) LP: #243630
+
+ -- Michael Vogt <mvo@debian.org> Fri, 04 Jul 2008 19:53:28 +0200
+
python-apt (0.7.6) unstable; urgency=low
* apt/cache.py:
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 4e53bbd4..71c9b4a7 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-07-04 11:09+0200\n"
+"POT-Creation-Date: 2008-07-04 19:45+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index ae1cf7be..dea34958 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -175,8 +175,11 @@ static PyObject *md5sum(PyObject *Self,PyObject *Args)
// Digest of a string.
if (PyString_Check(Obj) != 0)
{
+ char *s;
+ Py_ssize_t len;
MD5Summation Sum;
- Sum.Add(PyString_AsString(Obj));
+ PyString_AsStringAndSize(Obj, &s, &len);
+ Sum.Add((const unsigned char*)s, len);
return CppPyString(Sum.Result().Value());
}
@@ -212,8 +215,10 @@ static PyObject *sha1sum(PyObject *Self,PyObject *Args)
// Digest of a string.
if (PyString_Check(Obj) != 0)
{
+ char *s;
+ Py_ssize_t len;
SHA1Summation Sum;
- Sum.Add(PyString_AsString(Obj));
+ Sum.Add((const unsigned char*)s, len);
return CppPyString(Sum.Result().Value());
}
@@ -249,8 +254,11 @@ static PyObject *sha256sum(PyObject *Self,PyObject *Args)
// Digest of a string.
if (PyString_Check(Obj) != 0)
{
+ char *s;
+ Py_ssize_t len;
SHA256Summation Sum;
- Sum.Add(PyString_AsString(Obj));
+ PyString_AsStringAndSize(Obj, &s, &len);
+ Sum.Add((const unsigned char*)s, len);
return CppPyString(Sum.Result().Value());
}