##// END OF EJS Templates
manifest: fix out-of-bounds read of corrupted manifest entry...
Yuya Nishihara -
r40279:5405cb1a 4.7.2 stable
parent child Browse files
Show More
@@ -51,7 +51,12 b' static PyObject *nodeof(line *l)'
51 51 {
52 52 char *s = l->start;
53 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 60 if (!hash) {
56 61 return NULL;
57 62 }
@@ -249,10 +254,13 b' static PyObject *lmiter_iterentriesnext('
249 254 pl = pathlen(l);
250 255 path = PyBytes_FromStringAndSize(l->start, pl);
251 256 hash = nodeof(l);
257 if (!path || !hash) {
258 goto done;
259 }
252 260 consumed = pl + 41;
253 261 flags = PyBytes_FromStringAndSize(l->start + consumed,
254 262 l->len - consumed - 1);
255 if (!path || !hash || !flags) {
263 if (!flags) {
256 264 goto done;
257 265 }
258 266 ret = PyTuple_Pack(3, path, hash, flags);
General Comments 0
You need to be logged in to leave comments. Login now