# panic: runtime error: cgo argument has Go pointer to Go pointer

- **ID:** `go/cgo-char-array-null-termination`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Passing a Go slice or string to C as `char*` without null termination, causing C to read past bounds.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Use `C.CString` which allocates a null-terminated C string** (95% success)
   ```
   cs := C.CString("hello")
defer C.free(unsafe.Pointer(cs))
C.printString(cs)
   ```
2. **Manually append null byte and pin** (85% success)
   ```
   b := []byte("hello\x00")
C.printString((*C.char)(unsafe.Pointer(&b[0])))
   ```

## Dead Ends

- **Using `C.CString` but forgetting to free** — Memory leak, but the null termination is correct; this error is about pointer nesting. (40% fail)
- **Passing `&s[0]` directly** — Go string data is not null-terminated. (80% fail)
