From: Hwankyu Jhun Date: Mon, 5 Apr 2021 10:24:24 +0000 (+0900) Subject: Fix wrong implementation of packet class X-Git-Tag: accepted/tizen/unified/20210407.100457~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb19c6782beddc87ad6a137e9ee63f0ce1f20c62;p=platform%2Fcore%2Fappfw%2Faul-1.git Fix wrong implementation of packet class Change-Id: Id7a543306810a57543e1f6644c6659cf40af9acd Signed-off-by: Hwankyu Jhun --- diff --git a/aul/socket/packet.cc b/aul/socket/packet.cc index c531e48..4ff8507 100644 --- a/aul/socket/packet.cc +++ b/aul/socket/packet.cc @@ -88,8 +88,13 @@ void Packet::ReadFromParcel(tizen_base::Parcel* parcel) { parcel->ReadInt32(&size); parcel->ReadInt32(&opt_); if (size > 0) { - auto* p = reinterpret_cast(&data_[0]); - parcel->Read(p, size); + auto* data = new (std::nothrow) unsigned char [size]; + if (data == nullptr) + return; + + std::unique_ptr ptr(data); + parcel->Read(data, size); + std::copy(data, data + size, std::back_inserter(data_)); } }