-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove extra byte in realm_string_t conversion #918
Conversation
Pull Request Test Coverage Report for Build 3107262326
💛 - Coveralls |
Pull Request Test Coverage Report for Build 3107262326
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<int>.toCharPtr
ends up calling
Pointer<Uint8> toUint8Ptr(Allocator allocator) {
final nativeSize = length + 1;
final result = allocator<Uint8>(nativeSize);
final Uint8List native = result.asTypedList(nativeSize);
native.setAll(0, this); // copy
native.last = 0; // zero terminate
return result.cast();
}
i guess that need to be re-considered as well?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
realm_string_t
should never have been 0-terminated because it knows its own length. In fact, adding an extra empty byte will result in\u0000
being appended at the end of the string. I don't know how to test this since the only place it's used currently is for the password, but I've verified it manually by looking at the http request body.