Module Name:    src
Committed By:   dholland
Date:           Sun Aug 11 00:52:17 UTC 2013

Modified Files:
        src/usr.bin/tr: str.c

Log Message:
avoid undefined behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/tr/str.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.23 src/usr.bin/tr/str.c:1.24
--- src/usr.bin/tr/str.c:1.23	Sun Aug 11 00:39:22 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 00:52:17 2013
@@ -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 <sys/types.h>
@@ -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;

Reply via email to