mercurial/mpatch.c
branchstable
changeset 38189 faa924469635
parent 38188 1acfc35d478c
child 38190 1ec4cb8cbc87
equal deleted inserted replaced
38188:1acfc35d478c 38189:faa924469635
   246 	struct mpatch_frag *f = l->head;
   246 	struct mpatch_frag *f = l->head;
   247 	int last = 0;
   247 	int last = 0;
   248 	char *p = buf;
   248 	char *p = buf;
   249 
   249 
   250 	while (f != l->tail) {
   250 	while (f != l->tail) {
   251 		if (f->start < last || f->end > len || last < 0) {
   251 		if (f->start < last || f->start > len || f->end > len ||
       
   252 		    last < 0) {
   252 			return MPATCH_ERR_INVALID_PATCH;
   253 			return MPATCH_ERR_INVALID_PATCH;
   253 		}
   254 		}
   254 		memcpy(p, orig + last, f->start - last);
   255 		memcpy(p, orig + last, f->start - last);
   255 		p += f->start - last;
   256 		p += f->start - last;
   256 		memcpy(p, f->data, f->len);
   257 		memcpy(p, f->data, f->len);