From fb2122284b60d578ae59011a7eb331880b5bbf87 Mon Sep 17 00:00:00 2001 From: martijn Date: Tue, 12 Dec 2017 12:52:01 +0000 Subject: [PATCH] Fix 2 bugs introduced by previous. Pointed out by kshe59 zoho eu OK millert@ --- usr.bin/sed/compile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index c7a69f8248c..113adf671f3 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compile.c,v 1.44 2017/12/11 13:25:57 martijn Exp $ */ +/* $OpenBSD: compile.c,v 1.45 2017/12/12 12:52:01 martijn Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. @@ -603,7 +603,7 @@ static char * compile_tr(char *old, char **transtab) { int i; - char delimiter, check[UCHAR_MAX]; + char delimiter, check[UCHAR_MAX + 1]; char *new, *end; memset(check, 0, sizeof(check)); @@ -652,7 +652,7 @@ compile_tr(char *old, char **transtab) if (check[*old] == 1) error(COMPILE, "Repeated character in source string"); check[*old] = 1; - (*transtab)[*old++] = *new++; + (*transtab)[(u_char) *old++] = *new++; } if (*old != '\0' || *new != '\0') error(COMPILE, "transform strings are not the same length"); -- 2.20.1