1
0
mirror of https://github.com/golang/go synced 2024-11-25 20:37:56 -07:00

Continuation of issue 221 fix. When 8g or 6g or 5g are called with a

UTF-8 string, Yconv() converts it into an octal sequence. If the
string converted to more than 30 bytes, the str buffer would
overflow. For example, 4 Greek runes became 32 bytes, 3 Hiragana
runes became 36 bytes, and 2 Gothic runes became 32 bytes. In
8l, 6l and 5l the function is Sconv(). For some reason, only 5l uses
the constant STRINGSZ (defined as 200) for the buffer size.

R=rsc
https://golang.org/cl/168045
This commit is contained in:
Charles L. Dorian 2009-12-09 11:56:45 -08:00 committed by Russ Cox
parent 8a5b76ce5c
commit 3ca1b1d27f
5 changed files with 5 additions and 5 deletions

View File

@ -233,7 +233,7 @@ int
Yconv(Fmt *fp) Yconv(Fmt *fp)
{ {
int i, c; int i, c;
char str[30], *p, *a; char str[100], *p, *a;
a = va_arg(fp->args, char*); a = va_arg(fp->args, char*);
p = str; p = str;

View File

@ -353,7 +353,7 @@ int
Sconv(Fmt *fp) Sconv(Fmt *fp)
{ {
int i, c; int i, c;
char str[30], *p, *a; char str[100], *p, *a;
a = va_arg(fp->args, char*); a = va_arg(fp->args, char*);
p = str; p = str;

View File

@ -313,7 +313,7 @@ int
Yconv(Fmt *fp) Yconv(Fmt *fp)
{ {
int i, c; int i, c;
char str[30], *p, *a; char str[100], *p, *a;
a = va_arg(fp->args, char*); a = va_arg(fp->args, char*);
p = str; p = str;

View File

@ -274,7 +274,7 @@ int
Sconv(Fmt *fp) Sconv(Fmt *fp)
{ {
int i, c; int i, c;
char str[30], *p, *a; char str[100], *p, *a;
a = va_arg(fp->args, char*); a = va_arg(fp->args, char*);
p = str; p = str;

View File

@ -256,7 +256,7 @@ int
Yconv(Fmt *fp) Yconv(Fmt *fp)
{ {
int i, c; int i, c;
char str[30], *p, *a; char str[100], *p, *a;
a = va_arg(fp->args, char*); a = va_arg(fp->args, char*);
p = str; p = str;