Source-Changes-HG archive

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

[src/netbsd-8]: src/usr.bin/tr Pull up following revision(s) (requested by le...



details:   https://anonhg.NetBSD.org/src/rev/1970216890e8
branches:  netbsd-8
changeset: 435030:1970216890e8
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jun 08 10:02:59 2018 +0000

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

        usr.bin/tr/str.c: revision 1.30

Do not accept invalid octal character values (>= 0400).

This also avoid possible stack corruption (e.g. previously `tr -s '\400'' or
similars lead to them).

Reviewed and thanks to <pgoyette>!

diffstat:

 usr.bin/tr/str.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 149479e0bf33 -r 1970216890e8 usr.bin/tr/str.c
--- a/usr.bin/tr/str.c  Thu Jun 07 19:39:54 2018 +0000
+++ b/usr.bin/tr/str.c  Fri Jun 08 10:02:59 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.29 2013/08/11 01:54:35 dholland Exp $        */
+/*     $NetBSD: str.c,v 1.29.18.1 2018/06/08 10:02:59 martin Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)str.c      8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: str.c,v 1.29 2013/08/11 01:54:35 dholland Exp $");
+__RCSID("$NetBSD: str.c,v 1.29.18.1 2018/06/08 10:02:59 martin Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -417,6 +417,8 @@
        }
        if (cnt) {
                /* We saw digits, so return their value */
+               if (val >= OOBCH)
+                       errx(1, "Invalid octal character value");
                return val;
        }
        if (ch == '\0') {



Home | Main Index | Thread Index | Old Index