##// END OF EJS Templates
mpatch: avoid integer overflow in combine() (SEC)...
Augie Fackler -
r38253: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 248 /* insert new hunk */
249 249 ct = c->tail;
250 ct->start = bh->start - offset;
251 ct->end = bh->end - post;
250 ct->start = bh->start;
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 262 ct->len = bh->len;
253 263 ct->data = bh->data;
254 264 c->tail++;
@@ -259,7 +269,7 b' static struct mpatch_flist *combine(stru'
259 269 memcpy(c->tail, a->head, sizeof(struct mpatch_frag) * lsize(a));
260 270 c->tail += lsize(a);
261 271 }
262
272 done:
263 273 mpatch_lfree(a);
264 274 mpatch_lfree(b);
265 275 return c;
General Comments 0
You need to be logged in to leave comments. Login now