Also see caveats discussed here https://groups.google.com/d/topic/golan
g-nuts/sKQtvluD_So/discussion
On Tue, 2018-08-28 at 17:00 +, 'Borman, Paul' via golang-nuts
wrote:
> You are only overwriting the pointer to the string (a string is
> essentially a pointer and a length). If you want to us
You are only overwriting the pointer to the string (a string is essentially a
pointer and a length). If you want to use memory and then zero it out, use a
byte slice instead and be careful to not call append where append might
allocate new memory. Take a look at https://play.golang.org/p/GkrKR
Jay,
A Go string is represented by a struct.
type stringStruct struct {
str unsafe.Pointer
len int
}
Assigning a new value to a string variable is a struct assignment that does
not immediately destroy the underlying value of the original string.
Peter
On Tuesday, August 28, 2018 at 10
https://github.com/awnumar/memguard is the only project I've noticed that
attempts to deal with string security in Go.
I haven't used it personally.
On Tuesday, August 28, 2018 at 9:45:29 AM UTC-7, Jay Sharma wrote:
>
> *@Jan*, The example you shown it is copying a string to new variable. but
>
For security, you should use a []byte and overwrite there, and never create
a string out of it (that'd induce a copy).
2018. augusztus 28., kedd 18:45:29 UTC+2 időpontban Jay Sharma a következőt
írta:
>
> *@Jan*, The example you shown it is copying a string to new variable. but
> my question wa
On Tue, Aug 28, 2018 at 6:45 PM Jay Sharma wrote:
> @Jan, The example you shown it is copying a string to new variable. but
my question was related to same variable.
> Will it overwrite the same memory or it will create some copy ?
The same concept applies as before. String variables are unique
*@Jan*, The example you shown it is copying a string to new variable. but
my question was related to same variable.
I want to know if I have variable :
x := "testsring"
Now it overwrite the content of same variable x to some other value:
x = "new1string"
Will it overwrite the same memory or i
I think Jan answered the question asked. But, do you have some specific
concern that prompted the question? Is it about security, or memory usage,
or just curiosity?
On Tuesday, August 28, 2018 at 10:55:27 AM UTC-4, Jay Sharma wrote:
>
> Hi All,
>
> I went through documentation and many post. Ev