diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2008-07-04 20:15:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2008-07-04 20:15:25 +0200 |
| commit | 798980a40020e6571a284ae4c5336e3d210cb7fb (patch) | |
| tree | ff60318a6f9250ba3feeb2ca08b244ada1711314 /python | |
| parent | b6d95a31a6b8eb7f5d22eb040e7847b18f74cbf9 (diff) | |
| parent | 7625577a6974aa580877cf5d5ed22a6e663843fb (diff) | |
| download | python-apt-798980a40020e6571a284ae4c5336e3d210cb7fb.tar.gz | |
merged from mvo
Diffstat (limited to 'python')
| -rw-r--r-- | python/apt_pkgmodule.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index ae1cf7be..fd7a83cd 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,11 @@ 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)); + PyString_AsStringAndSize(Obj, &s, &len); + Sum.Add((const unsigned char*)s, len); return CppPyString(Sum.Result().Value()); } @@ -249,8 +255,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()); } |
