Re: patch: check patch file size

2014-11-17 Thread Tobias Stoeckmann
On Sun, Nov 16, 2014 at 06:19:17PM -0500, Ted Unangst wrote: > I think using the correct data type is the right thing to do. If it's > the size of a file, it goes in an off_t. The only thing to watch for > is passing an off_t to malloc(), where it can wrap and be truncated. Yes, off_t for memory o

Re: patch: check patch file size

2014-11-16 Thread Ted Unangst
On Sun, Nov 16, 2014 at 23:33, Ingo Schwarze wrote: > Hi Tobias, > > Tobias Stoeckmann wrote on Sun, Nov 16, 2014 at 09:58:43PM +0100: >> On Sun, Nov 16, 2014 at 09:39:32PM +0100, Alexander Bluhm wrote: > >>> Can we change p_filesize type to off_t instead? > >> Definitely, but it takes closer lo

Re: patch: check patch file size

2014-11-16 Thread Ingo Schwarze
Hi Tobias, Tobias Stoeckmann wrote on Sun, Nov 16, 2014 at 09:58:43PM +0100: > On Sun, Nov 16, 2014 at 09:39:32PM +0100, Alexander Bluhm wrote: >> Can we change p_filesize type to off_t instead? > Definitely, but it takes closer looks for a review. Diff exists, OK schwarze@ (from careful code

Re: patch: check patch file size

2014-11-16 Thread Tobias Stoeckmann
On Sun, Nov 16, 2014 at 09:39:32PM +0100, Alexander Bluhm wrote: > Can we change p_filesize type to off_t instead? Definitely, but it takes closer looks for a review. Diff exists, I was just not sure if it's worth to support patch files which are larger than 2 GB on 32 bit systems. Tobias Inde

Re: patch: check patch file size

2014-11-16 Thread Alexander Bluhm
On Sun, Nov 16, 2014 at 09:23:49PM +0100, Tobias Stoeckmann wrote: > p_filesize is of type long, but we assign an off_t. Before assignment, > check if it will fit. Can we change p_filesize type to off_t instead? bluhm

patch: check patch file size

2014-11-16 Thread Tobias Stoeckmann
Hi, p_filesize is of type long, but we assign an off_t. Before assignment, check if it will fit. Also, check if fstat was successful or not. Tobias Index: pch.c === RCS file: /cvs/src/usr.bin/patch/pch.c,v retrieving revision 1.4