mirror of
https://github.com/golang/go
synced 2024-11-23 13:10:15 -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:
parent
59cb2d9ca6
commit
10be797578
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user