vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Sat, 1 Apr 2006, Tobias Stoeckmann wrote: > On Sat, Apr 01, 2006 at 06:11:29PM +0200, Otto Moerbeek wrote: > > > > It is better to check against SIZE_T_MAX > > > > Oops, sorry about that, I used my 3.8 system and hat no SIZE_T_MAX. > Next time I will use header files of -current. Oops, I meant to say SIZE_MAX SIZE_T_MAX is not POSIX. -Otto > > Modified patch (">=" instead of "> - 1" and "!" instead of "== 0"): > > --- usr.bin/gzsig/key.c~ Sat Apr 1 16:46:42 2006 > +++ usr.bin/gzsig/key.c Sat Apr 1 16:47:58 2006 > @@ -33,6 +33,7 @@ > * $Vendor: key.c,v 1.2 2005/04/01 16:47:31 dugsong Exp $ > */ > > +#include <sys/limits.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <sys/uio.h> > @@ -78,7 +79,7 @@ > if (fstat(fd, &st) < 0) > return (-1); > > - if (st.st_size == 0) { > + if (!st.st_size || st.st_size >= SIZE_T_MAX) { > errno = EINVAL; > return (-1); > } > > Tobias Stoeckmann |