=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/update.c,v retrieving revision 1.173 retrieving revision 1.174 diff -c -r1.173 -r1.174 *** src/usr.bin/cvs/update.c 2016/10/14 20:37:07 1.173 --- src/usr.bin/cvs/update.c 2016/10/15 22:20:17 1.174 *************** *** 1,4 **** ! /* $OpenBSD: update.c,v 1.173 2016/10/14 20:37:07 fcambus Exp $ */ /* * Copyright (c) 2006 Joris Vink * --- 1,4 ---- ! /* $OpenBSD: update.c,v 1.174 2016/10/15 22:20:17 millert Exp $ */ /* * Copyright (c) 2006 Joris Vink * *************** *** 259,271 **** if (fstat(cf->fd, &st) == -1) fatal("cvs_update_leavedir: %s", strerror(errno)); ! bufsize = st.st_size; ! if (bufsize < st.st_blksize) ! bufsize = st.st_blksize; ! ! if (st.st_size > SIZE_MAX) fatal("cvs_update_leavedir: %s: file size too big", cf->file_name); isempty = 1; buf = xmalloc(bufsize); --- 259,269 ---- if (fstat(cf->fd, &st) == -1) fatal("cvs_update_leavedir: %s", strerror(errno)); ! if ((uintmax_t)st.st_size > SIZE_MAX) fatal("cvs_update_leavedir: %s: file size too big", cf->file_name); + + bufsize = (st.st_size > st.st_blksize) ? st.st_size : st.st_blksize; isempty = 1; buf = xmalloc(bufsize);