Subject: bin/4303: as treats escapes in strings the wrong way.
To: None <gnats-bugs@gnats.netbsd.org>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: netbsd-bugs
Date: 10/20/1997 14:13:30
>Number: 4303
>Category: bin
>Synopsis: as treats escapes in strings the wrong way.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Oct 20 05:20:03 1997
>Last-Modified:
>Originator: Lennart Augustsson
>Organization:
>Release: NetBSD-current 971020
>Environment:
System: NetBSD dogbert.cs.chalmers.se 1.2D NetBSD 1.2D (DOGBERT) #0: Thu Mar 20 17:52:53 MET 1997 root@dogbert.cs.chalmers.se:/usr/src/sys/arch/i386/compile/DOGBERT i386
>Description:
When \NNN is used in strings in the input to as it decodes them
in the wrong way. The right way is use at most 3 digits after
the \, not all of them.
>How-To-Repeat:
Try this:
.ascii "\040040"
This should be the string " 040", not " ".
>Fix:
Apply the patch below.
*** read.c.old Mon Oct 20 14:06:38 1997
--- read.c Mon Oct 20 14:07:38 1997
***************
*** 2095,2102 ****
case '8':
case '9': {
long number;
! for (number = 0; isdigit(c); c = *input_line_pointer++) {
number = number * 8 + c - '0';
}
c = number & 0xff;
--- 2095,2105 ----
case '8':
case '9': {
long number;
+ int nchar;
! for (nchar = 0, number = 0;
! nchar < 3 && isdigit(c);
! c = *input_line_pointer++, nchar++) {
number = number * 8 + c - '0';
}
c = number & 0xff;
>Audit-Trail:
>Unformatted: