summaryrefslogtreecommitdiff
path: root/src/tr.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-03-14 03:59:21 +0000
committerJim Meyering <jim@meyering.net>1997-03-14 03:59:21 +0000
commitc127695e96f62f61a94e9f8227abd4b7e71c6088 (patch)
treeb606b937809ffdaf7a9b7563af7c896265a29bd3 /src/tr.c
parentd7135088021d0ee8aed83407fae595d78c1f6aa1 (diff)
downloadcoreutils-c127695e96f62f61a94e9f8227abd4b7e71c6088.tar.xz
(main): Make sure c1 is not -1 before using it as an
array index. Patch from Greg McGary. Although this is truly a bug, I believe it would not cause tr to misbehave on most systems. I could not construct a test case with which this bug causes tr to generate invalid output.
Diffstat (limited to 'src/tr.c')
-rw-r--r--src/tr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tr.c b/src/tr.c
index da9b2f381..7005ae331 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -2033,7 +2033,7 @@ construct in string1 must be aligned with a corresponding construct\n\
else
{
/* The following should have been checked by validate... */
- if (c2 == -1)
+ if (c1 == -1 || c2 == -1)
break;
xlate[c1] = c2;
}