Commit 10be7975 authored by David du Colombier's avatar David du Colombier

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/2033Reviewed-by: 's avatarAram Hăvărneanu <aram@mgk.ro>
parent 59cb2d9c
......@@ -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])
......
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