Show More
@@ -51,7 +51,12 b' static PyObject *nodeof(line *l)' | |||||
51 | { |
|
51 | { | |
52 | char *s = l->start; |
|
52 | char *s = l->start; | |
53 | ssize_t llen = pathlen(l); |
|
53 | ssize_t llen = pathlen(l); | |
54 | PyObject *hash = unhexlify(s + llen + 1, 40); |
|
54 | PyObject *hash; | |
|
55 | if (llen + 1 + 40 + 1 > l->len) { /* path '\0' hash '\n' */ | |||
|
56 | PyErr_SetString(PyExc_ValueError, "manifest line too short"); | |||
|
57 | return NULL; | |||
|
58 | } | |||
|
59 | hash = unhexlify(s + llen + 1, 40); | |||
55 | if (!hash) { |
|
60 | if (!hash) { | |
56 | return NULL; |
|
61 | return NULL; | |
57 | } |
|
62 | } | |
@@ -249,10 +254,13 b' static PyObject *lmiter_iterentriesnext(' | |||||
249 | pl = pathlen(l); |
|
254 | pl = pathlen(l); | |
250 | path = PyBytes_FromStringAndSize(l->start, pl); |
|
255 | path = PyBytes_FromStringAndSize(l->start, pl); | |
251 | hash = nodeof(l); |
|
256 | hash = nodeof(l); | |
|
257 | if (!path || !hash) { | |||
|
258 | goto done; | |||
|
259 | } | |||
252 | consumed = pl + 41; |
|
260 | consumed = pl + 41; | |
253 | flags = PyBytes_FromStringAndSize(l->start + consumed, |
|
261 | flags = PyBytes_FromStringAndSize(l->start + consumed, | |
254 | l->len - consumed - 1); |
|
262 | l->len - consumed - 1); | |
255 |
if (! |
|
263 | if (!flags) { | |
256 | goto done; |
|
264 | goto done; | |
257 | } |
|
265 | } | |
258 | ret = PyTuple_Pack(3, path, hash, flags); |
|
266 | ret = PyTuple_Pack(3, path, hash, flags); |
General Comments 0
You need to be logged in to leave comments.
Login now