Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 1998 12:51:30 -0700 (PDT)
From:      Elmar.Bartel@informatik.tu-muenchen.de
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/6458: sed is not 8bit-clean on y-command
Message-ID:  <199804291951.MAA13127@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         6458
>Category:       bin
>Synopsis:       sed is not 8bit-clean on y-command
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 29 13:00:01 PDT 1998
>Last-Modified:
>Originator:     Elmar Bartel
>Organization:
Technische Universität München
>Release:        2.2.6
>Environment:
Not relevant

>Description:
The implementation of the 
'y' command relies on the fact, that all input charactes have
positive value. If fed with a character with value beyond 127 it
is interpreted as a negative index to the constructed translation array.
>How-To-Repeat:
echo á | sed -e y/á/a/

Youy won't get the expected 'a' as output (probably a 0-byte instead).
>Fix:
--- /tmp/process.c      Wed Apr 29 21:45:04 1998
+++ /tmp/process.c.new  Wed Apr 29 21:46:20 1998
@@ -240,7 +240,7 @@
                                if (pd)
                                        break;
                                for (p = ps, len = psl; --len; ++p)
-                                       *p = cp->u.y[*p];
+                                       *p = cp->u.y[*(unsigned char*)p];
                                break;
                        case ':':
                        case '}':

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804291951.MAA13127>