##// END OF EJS Templates
mpatch: avoid integer overflow in combine() (SEC)...
Augie Fackler -
r38490:9c5ced52 4.6.1 stable
parent child Browse files
Show More
@@ -247,8 +247,18 b' static struct mpatch_flist *combine(stru'
247
247
248 /* insert new hunk */
248 /* insert new hunk */
249 ct = c->tail;
249 ct = c->tail;
250 ct->start = bh->start - offset;
250 ct->start = bh->start;
251 ct->end = bh->end - post;
251 ct->end = bh->end;
252 if (!safesub(offset, &(ct->start)) ||
253 !safesub(post, &(ct->end))) {
254 /* It was already possible to exit
255 * this function with a return value
256 * of NULL before the safesub()s were
257 * added, so this should be fine. */
258 mpatch_lfree(c);
259 c = NULL;
260 goto done;
261 }
252 ct->len = bh->len;
262 ct->len = bh->len;
253 ct->data = bh->data;
263 ct->data = bh->data;
254 c->tail++;
264 c->tail++;
@@ -259,7 +269,7 b' static struct mpatch_flist *combine(stru'
259 memcpy(c->tail, a->head, sizeof(struct mpatch_frag) * lsize(a));
269 memcpy(c->tail, a->head, sizeof(struct mpatch_frag) * lsize(a));
260 c->tail += lsize(a);
270 c->tail += lsize(a);
261 }
271 }
262
272 done:
263 mpatch_lfree(a);
273 mpatch_lfree(a);
264 mpatch_lfree(b);
274 mpatch_lfree(b);
265 return c;
275 return c;
General Comments 0
You need to be logged in to leave comments. Login now