Commit 3ca1b1d2 authored by Charles L. Dorian's avatar Charles L. Dorian Committed by Russ Cox

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
parent 8a5b76ce
...@@ -233,7 +233,7 @@ int ...@@ -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;
......
...@@ -353,7 +353,7 @@ int ...@@ -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;
......
...@@ -313,7 +313,7 @@ int ...@@ -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;
......
...@@ -274,7 +274,7 @@ int ...@@ -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;
......
...@@ -256,7 +256,7 @@ int ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment