Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a6161c6 authored by Etan Cohen's avatar Etan Cohen
Browse files

[NAN] Fix assumption about Strings containing single-byte characters.

Code assumed that each character was represented by a single byte.

Change-Id: I92ea63f7273379ed1035f10c207d41e3e352bf38
parent 15849dc4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -380,8 +380,8 @@ public class PublishConfig implements Parcelable {
         *         {@code builder.setXXX(..).setXXX(..)}.
         */
        public Builder setServiceSpecificInfo(@NonNull String serviceSpecificInfoStr) {
            mServiceSpecificInfoLength = serviceSpecificInfoStr.length();
            mServiceSpecificInfo = serviceSpecificInfoStr.getBytes();
            mServiceSpecificInfoLength = mServiceSpecificInfo.length;
            return this;
        }

+1 −1
Original line number Diff line number Diff line
@@ -413,8 +413,8 @@ public class SubscribeConfig implements Parcelable {
         *         {@code builder.setXXX(..).setXXX(..)}.
         */
        public Builder setServiceSpecificInfo(@NonNull String serviceSpecificInfoStr) {
            mServiceSpecificInfoLength = serviceSpecificInfoStr.length();
            mServiceSpecificInfo = serviceSpecificInfoStr.getBytes();
            mServiceSpecificInfoLength = mServiceSpecificInfo.length;
            return this;
        }

+2 −1
Original line number Diff line number Diff line
@@ -224,7 +224,8 @@ public class TlvBufferUtils {
         *         {@code ctr.putXXX(..).putXXX(..)}.
         */
        public TlvConstructor putString(int type, String data) {
            return putByteArray(type, data.getBytes(), 0, data.length());
            byte[] bytes = data.getBytes();
            return putByteArray(type, bytes, 0, bytes.length);
        }

        /**