error
SCCS-vsn: usr.bin/tail/forward.c 5.8
SCCS-vsn: usr.bin/tail/reverse.c 5.7
SCCS-vsn: usr.bin/tail/tail.c 5.12
-static char sccsid[] = "@(#)forward.c 5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)forward.c 5.8 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/mman.h>
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
if (!(size = sbp->st_size))
return;
if (!(size = sbp->st_size))
return;
+ if (size > SIZE_T_MAX) {
+ err(0, "%s: %s", fname, strerror(EFBIG));
+ return;
+ }
+
if ((start = mmap(NULL, (size_t)size,
if ((start = mmap(NULL, (size_t)size,
- PROT_READ, MAP_FILE, fileno(fp), (off_t)0)) == (caddr_t)-1) {
- err(0, "%s", strerror(errno));
+ PROT_READ, 0, fileno(fp), (off_t)0)) == (caddr_t)-1) {
+ err(0, "%s: %s", fname, strerror(EFBIG));
- if (munmap(start, size)) {
- err(0, "%s", strerror(errno));
+ if (munmap(start, (size_t)size)) {
+ err(0, "%s: %s", fname, strerror(errno));
-static char sccsid[] = "@(#)reverse.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)reverse.c 5.7 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mman.h>
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
if (!(size = sbp->st_size))
return;
if (!(size = sbp->st_size))
return;
+ if (size > SIZE_T_MAX) {
+ err(0, "%s: %s", fname, strerror(EFBIG));
+ return;
+ }
+
if ((p = mmap(NULL, (size_t)size,
if ((p = mmap(NULL, (size_t)size,
- PROT_READ, MAP_FILE, fileno(fp), (off_t)0)) == (caddr_t)-1) {
- err(0, "%s", strerror(errno));
+ PROT_READ, 0, fileno(fp), (off_t)0)) == (caddr_t)-1) {
+ err(0, "%s: %s", fname, strerror(EFBIG));
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)tail.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)tail.c 5.12 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>