From d506ddf6f730bbb28d01fec9e8eee45e662a7399 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 11 Aug 2013 00:52:17 +0000 Subject: [PATCH] avoid undefined behavior. --- usr.bin/tr/str.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c index 14b68a09781c..c6177d4eaa66 100644 --- a/usr.bin/tr/str.c +++ b/usr.bin/tr/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.23 2013/08/11 00:39:22 dholland Exp $ */ +/* $NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland 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.23 2013/08/11 00:39:22 dholland Exp $"); +__RCSID("$NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $"); #endif /* not lint */ #include @@ -277,8 +277,8 @@ genrange(STR *s) int stopval; const char *savestart; - savestart = s->str; - stopval = *++s->str == '\\' ? backslash(s) : *s->str++; + savestart = s->str++; + stopval = *s->str == '\\' ? backslash(s) : *s->str++; if (stopval < (u_char)s->lastch) { s->str = savestart; return 0;