=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.268 retrieving revision 1.269 diff -c -r1.268 -r1.269 *** src/usr.bin/cvs/file.c 2016/10/13 20:51:25 1.268 --- src/usr.bin/cvs/file.c 2016/10/15 22:20:17 1.269 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.268 2016/10/13 20:51:25 fcambus Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2004 Jean-Francois Brousseau --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.269 2016/10/15 22:20:17 millert Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2004 Jean-Francois Brousseau *************** *** 461,472 **** fatal("cvs_file_walkdir: %s %s", cf->file_path, strerror(errno)); ! if (st.st_size > SIZE_MAX) fatal("cvs_file_walkdir: %s: file size too big", cf->file_name); ! bufsize = st.st_size; ! if (bufsize < st.st_blksize) ! bufsize = st.st_blksize; buf = xmalloc(bufsize); RB_INIT(&fl); --- 461,470 ---- fatal("cvs_file_walkdir: %s %s", cf->file_path, strerror(errno)); ! if ((uintmax_t)st.st_size > SIZE_MAX) fatal("cvs_file_walkdir: %s: file size too big", cf->file_name); ! bufsize = (st.st_size > st.st_blksize) ? st.st_size : st.st_blksize; buf = xmalloc(bufsize); RB_INIT(&fl); *************** *** 1030,1036 **** if (S_ISREG(stb1.st_mode)) { void *p1, *p2; ! if (stb1.st_size > SIZE_MAX) { ret = 1; goto out; } --- 1028,1034 ---- if (S_ISREG(stb1.st_mode)) { void *p1, *p2; ! if ((uintmax_t)stb1.st_size > SIZE_MAX) { ret = 1; goto out; } *************** *** 1087,1093 **** char *p; int saved_errno; ! if (st.st_size > SIZE_MAX) { ret = -1; goto out; } --- 1085,1091 ---- char *p; int saved_errno; ! if ((uintmax_t)st.st_size > SIZE_MAX) { ret = -1; goto out; } *************** *** 1106,1112 **** madvise(p, st.st_size, MADV_SEQUENTIAL); ! if (atomicio(vwrite, dst, p, st.st_size) != st.st_size) { saved_errno = errno; (void)unlink(to); fatal("cvs_file_copy: `%s': %s", from, --- 1104,1110 ---- madvise(p, st.st_size, MADV_SEQUENTIAL); ! if (atomicio(vwrite, dst, p, st.st_size) != (size_t)st.st_size) { saved_errno = errno; (void)unlink(to); fatal("cvs_file_copy: `%s': %s", from,