OSDN Git Service

Fix wrong userData length and excessive userData issues
authorTaesu Lee <taesu82.lee@samsung.com>
Thu, 31 Jan 2019 05:38:56 +0000 (14:38 +0900)
committerTaesu Lee <taesu82.lee@samsung.com>
Thu, 31 Jan 2019 23:51:56 +0000 (08:51 +0900)
commit309fc2d4a804d6c46c6df183f616e325759762ff
treed29c9e772bd35e8d1a32dd863901de07b1e6c4af
parent643e60b0fed9d113a4a35847f61a98c2f0e3e6f9
Fix wrong userData length and excessive userData issues

Added checking size excess in encodeUCS2() and an exception cause in
EncodeException to distinguish between unencodable char and size excess.
It will prevent wrong userData length and excessive userData issues
during encoding userData. Please see below one issue scenario.

stringToGsm7BitPackedWithHeader() throws an EncodeException when
septeCount > 255. The EncodeException is caught and encoding again
through encodeUCS2(). However, the length of encoded userData as UCS-2
is converted as Byte without checking size excess. Thus first byte of
userData will be wrong and total userData will exceed maximum User Data.

Test: Manual

Change-Id: Ib6df5484072d77548e8adcbcbd15ad7a401c99f8
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
telephony/java/com/android/internal/telephony/EncodeException.java
telephony/java/com/android/internal/telephony/GsmAlphabet.java
telephony/java/com/android/internal/telephony/gsm/SmsMessage.java