You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recommendation:
Do not import package unsafe for conversions as a general rule of thumb, the potential to lead to these sort of issues is high. Doing this for []byte() to string is actually less justified as the compiler does have optimizations in some places to help with this when it can prove that it is safe. Use string(byteSliceVal) instead.
The call to SetSecure at https://github.com/chmike/cookie/blob/master/cookie.go#L142 uses the unsafe package to convert to an assumed immutable structure (string) with a mutable slice backing (sync.Pool).
Recommendation:
Do not import package unsafe for conversions as a general rule of thumb, the potential to lead to these sort of issues is high. Doing this for []byte() to string is actually less justified as the compiler does have optimizations in some places to help with this when it can prove that it is safe. Use
string(byteSliceVal)
instead.Reproduce:
Output:
The text was updated successfully, but these errors were encountered: