bspatch.c (285830) | bspatch.c (303304) |
---|---|
1/*- 2 * Copyright 2003-2005 Colin Percival 3 * All rights reserved 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted providing that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright 2003-2005 Colin Percival 3 * All rights reserved 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted providing that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: releng/10.2/usr.bin/bsdiff/bspatch/bspatch.c 164922 2006-12-05 20:22:14Z cperciva $"); | 28__FBSDID("$FreeBSD: releng/10.2/usr.bin/bsdiff/bspatch/bspatch.c 303304 2016-07-25 15:04:17Z delphij $"); |
29 30#include <bzlib.h> 31#include <stdlib.h> 32#include <stdio.h> 33#include <string.h> 34#include <err.h> 35#include <unistd.h> 36#include <fcntl.h> --- 113 unchanged lines hidden (view full) --- 150 lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8); 151 if ((lenread < 8) || ((cbz2err != BZ_OK) && 152 (cbz2err != BZ_STREAM_END))) 153 errx(1, "Corrupt patch\n"); 154 ctrl[i]=offtin(buf); 155 }; 156 157 /* Sanity-check */ | 29 30#include <bzlib.h> 31#include <stdlib.h> 32#include <stdio.h> 33#include <string.h> 34#include <err.h> 35#include <unistd.h> 36#include <fcntl.h> --- 113 unchanged lines hidden (view full) --- 150 lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8); 151 if ((lenread < 8) || ((cbz2err != BZ_OK) && 152 (cbz2err != BZ_STREAM_END))) 153 errx(1, "Corrupt patch\n"); 154 ctrl[i]=offtin(buf); 155 }; 156 157 /* Sanity-check */ |
158 if ((ctrl[0] < 0) || (ctrl[1] < 0)) 159 errx(1,"Corrupt patch\n"); 160 161 /* Sanity-check */ |
|
158 if(newpos+ctrl[0]>newsize) 159 errx(1,"Corrupt patch\n"); 160 161 /* Read diff string */ 162 lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]); 163 if ((lenread < ctrl[0]) || 164 ((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END))) 165 errx(1, "Corrupt patch\n"); --- 42 unchanged lines hidden --- | 162 if(newpos+ctrl[0]>newsize) 163 errx(1,"Corrupt patch\n"); 164 165 /* Read diff string */ 166 lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]); 167 if ((lenread < ctrl[0]) || 168 ((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END))) 169 errx(1, "Corrupt patch\n"); --- 42 unchanged lines hidden --- |