Show More
@@ -248,7 +248,7 b' int mpatch_apply(char *buf, const char *' | |||
|
248 | 248 | char *p = buf; |
|
249 | 249 | |
|
250 | 250 | while (f != l->tail) { |
|
251 | if (f->start < last || f->end > len) { | |
|
251 | if (f->start < last || f->end > len || last < 0) { | |
|
252 | 252 | return MPATCH_ERR_INVALID_PATCH; |
|
253 | 253 | } |
|
254 | 254 | memcpy(p, orig + last, f->start - last); |
@@ -258,6 +258,9 b' int mpatch_apply(char *buf, const char *' | |||
|
258 | 258 | p += f->len; |
|
259 | 259 | f++; |
|
260 | 260 | } |
|
261 | if (last < 0) { | |
|
262 | return MPATCH_ERR_INVALID_PATCH; | |
|
263 | } | |
|
261 | 264 | memcpy(p, orig + last, len - last); |
|
262 | 265 | return 0; |
|
263 | 266 | } |
General Comments 0
You need to be logged in to leave comments.
Login now