LittleDemon WebShell


Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
Path : /opt/go/pkg/mod/github.com/go-openapi/swag@v0.22.9/
File Upload :
Command :
Current File : //opt/go/pkg/mod/github.com/go-openapi/swag@v0.22.9/string_bytes.go

package swag

import "unsafe"

type internalString struct {
	Data unsafe.Pointer
	Len  int
}

// hackStringBytes returns the (unsafe) underlying bytes slice of a string.
func hackStringBytes(str string) []byte {
	p := (*internalString)(unsafe.Pointer(&str)).Data
	return unsafe.Slice((*byte)(p), len(str))
}

/*
 * go1.20 version (for when go mod moves to a go1.20 requirement):

func hackStringBytes(str string) []byte {
	return unsafe.Slice(unsafe.StringData(str), len(str))
}
*/

LittleDemon - FACEBOOK
[ KELUAR ]