Skip to content

Commit 9c1c488

Browse files
FedeDPpoiana
authored andcommitted
fix(plugins/container): use C.GoString() in AskForContainerInfo.
Since the c string comes from a stack variable `.c_str()`, and the go string will be used async, `ptr.GoString()` does not guarantee that the string is kept alive for all its duration, leading to bogus reads. Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
1 parent c1e1c8f commit 9c1c488

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/container/go-worker/worker_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func StopWorker(pCtx unsafe.Pointer) {
113113

114114
//export AskForContainerInfo
115115
func AskForContainerInfo(containerId *C.cchar_t) {
116-
containerID := ptr.GoString(unsafe.Pointer(containerId))
116+
containerID := C.GoString(containerId)
117117
ch := container.GetFetcherChan()
118118
if ch != nil {
119119
ch <- containerID

0 commit comments

Comments
 (0)