1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:30:05 -07:00

runtime: fix exit on Plan 9

Add a nil byte at the end of the itoa buffer,
before calling gostringnocopy. This prevents
gostringnocopy to read past the buffer size.

Change-Id: I87494a8dd6ea45263882536bf6c0f294eda6866d
Reviewed-on: https://go-review.googlesource.com/2033
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
This commit is contained in:
David du Colombier 2014-12-23 11:09:15 +01:00
parent 59cb2d9ca6
commit 10be797578

View File

@ -182,7 +182,7 @@ func exit(e int) {
} else {
// build error string
var tmp [32]byte
status = []byte(gostringnocopy(&itoa(tmp[:], uint64(e))[0]) + "\x00")
status = []byte(gostringnocopy(&itoa(tmp[:len(tmp)-1], uint64(e))[0]))
}
goexitsall(&status[0])
exits(&status[0])