summaryrefslogtreecommitdiffstats
path: root/usr.bin/tr/str.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>2004-11-14 05:15:25 +0000
committerjkh <jkh@FreeBSD.org>2004-11-14 05:15:25 +0000
commit05757f7ee04636002686ea63abf80bef16d1f61e (patch)
treea85819b1b43974379527a2075bdbd2c62988b9a0 /usr.bin/tr/str.c
parent75553849efc600a68bc4722375e039bdeea609cb (diff)
downloadFreeBSD-src-05757f7ee04636002686ea63abf80bef16d1f61e.zip
FreeBSD-src-05757f7ee04636002686ea63abf80bef16d1f61e.tar.gz
tr(1) attempts to convert \n[n][n] sequences into octal digits, but doesn't
check to see that a given digit is actually an octal digit. This leads to unusual consequences if passed in values like \9. Reported by: Joseph Davison (OpenDarwin project) MFC after: 1 week
Diffstat (limited to 'usr.bin/tr/str.c')
-rw-r--r--usr.bin/tr/str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c
index f28b243..c023fea 100644
--- a/usr.bin/tr/str.c
+++ b/usr.bin/tr/str.c
@@ -358,7 +358,7 @@ backslash(STR *s, int *is_octal)
*is_octal = 0;
for (cnt = val = 0;;) {
ch = (u_char)*++s->str;
- if (!isdigit(ch))
+ if (!isdigit(ch) || ch > '7')
break;
val = val * 8 + ch - '0';
if (++cnt == 3) {
OpenPOWER on IntegriCloud