Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.bin/look Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/1378ec5d3350
branches:  netbsd-7
changeset: 319658:1378ec5d3350
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jun 06 15:15:01 2018 +0000

description:
Pull up following revision(s) (requested by leot in ticket #1610):

        usr.bin/look/look.c: revision 1.17

Properly check mmap(2) return value. We can end up with a segmentation
fault if the user does not provide a regular file as look(1) file
argument.

Kindly reviewed by <Riastradh>

diffstat:

 usr.bin/look/look.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r c74f6eed895c -r 1378ec5d3350 usr.bin/look/look.c
--- a/usr.bin/look/look.c       Wed Jun 06 15:13:00 2018 +0000
+++ b/usr.bin/look/look.c       Wed Jun 06 15:15:01 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: look.c,v 1.16 2012/02/23 22:57:53 joerg Exp $  */
+/*     $NetBSD: look.c,v 1.16.10.1 2018/06/06 15:15:01 martin Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)look.c     8.2 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: look.c,v 1.16 2012/02/23 22:57:53 joerg Exp $");
+__RCSID("$NetBSD: look.c,v 1.16.10.1 2018/06/06 15:15:01 martin Exp $");
 #endif /* not lint */
 
 /*
@@ -147,7 +147,7 @@
                err(2, "%s", file);
        }
        if ((front = mmap(NULL, len,
-           PROT_READ, MAP_FILE|MAP_SHARED, fd, (off_t)0)) == NULL)
+           PROT_READ, MAP_FILE|MAP_SHARED, fd, (off_t)0)) == MAP_FAILED)
                err(2, "%s", file);
        back = front + len;
        exit(look(string, front, back));



Home | Main Index | Thread Index | Old Index