You can chat about native SDK questions and issues here.

User avatar
By davydnorris
#83341
quackmore wrote:I don't like os_memcpy(ap.password, "", 10)
but in case you are lucky it will end up with an empty password



It's not the result that's the problem - it's the operation. This will attempt to copy 10 bytes from a memory location pointing to '\0'. If the code is bounds checking arrays then you'll get exactly the error the OP mentioned.

I'm hoping they just deleted the plain text password as part of their post
User avatar
By quackmore
#83343 Don't think so

That's an empty string, not NULL

The '\0' will be copied at the beginning of the password, then 9 other "unknown" characters will follow
User avatar
By davydnorris
#83355
quackmore wrote:Don't think so

That's an empty string, not NULL

The '\0' will be copied at the beginning of the password, then 9 other "unknown" characters will follow


Correct - an empty string is the character '\0'.

The problem is that the code is asking to copy 10 bytes from a location that is only officially 1 byte long. Bounds checking in the copy routine will throw a LoadProhibitedCause 28 exception when you overrun the end of the source.

We really need to hear from the OP as to whether this code is what is written or if it was edited for the post
User avatar
By quackmore
#83356
Code: Select allThe problem is that the code is asking to copy 10 bytes from a location that is only officially 1 byte long.


Agreed
Totally see what you mean
Not sure about way it could lead to a memory violation but it could and it's definitely not good
That's why I said I didn't like it