From: Ken Thompson Date: Wed, 27 May 2009 22:56:44 +0000 (-0700) Subject: added protection against race condition X-Git-Tag: weekly.2009-11-06~1525 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=77f668a0f118276fdfdbe0ba65751c3039e5f5f5;p=gostls13.git added protection against race condition between first and second pass of converting []int to string. R=r OCL=29467 CL=29467 --- diff --git a/src/runtime/string.c b/src/runtime/string.c index 04cf06bc3c..5bfe8196f7 100644 --- a/src/runtime/string.c +++ b/src/runtime/string.c @@ -184,21 +184,25 @@ sys·arraystring(Array b, String s) void sys·arraystringi(Array b, String s) { - int32 siz, i; + int32 siz1, siz2, i; int32 *a; byte dum[8]; a = (int32*)b.array; - siz = 0; + siz1 = 0; for(i=0; i= siz1) + break; + siz2 += runetochar(s.str+siz2, a[i]); } + s.len = siz2; FLUSH(&s); }