From: David Steele Date: Wed, 16 Nov 2022 16:16:59 +0000 (+0000) Subject: Prevented buffer clipping in network server X-Git-Tag: dali_2.2.3~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a25419b81b7d04d737ba0d6e36f560aeeb535a5e;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Prevented buffer clipping in network server Marker output was clipped to 64 characters, and new line was not inserted. Changed to use asprintf rather than fixed size buffer. Marker output is now properly outputting 1 per line. Change-Id: Id7970486dff11f28ed41315c774509577b9ea32d --- diff --git a/dali/internal/network/common/network-performance-client.cpp b/dali/internal/network/common/network-performance-client.cpp index 4a02097..b4e0719 100644 --- a/dali/internal/network/common/network-performance-client.cpp +++ b/dali/internal/network/common/network-performance-client.cpp @@ -190,11 +190,12 @@ bool NetworkPerformanceClient::TransmitMarker(const PerformanceMarker& marker, c if(mConsoleClient) { // write out the time stamp - char buffer[64]; + char *buffer; double usec = marker.GetTimeStamp().microseconds; - int size = snprintf(buffer, sizeof(buffer), "%.6f (seconds), %s\n", usec * MICROSECONDS_TO_SECOND, description); - - return mSocket->Write(buffer, size); + int size = asprintf(&buffer, "%.6f (seconds), %s\n", usec * MICROSECONDS_TO_SECOND, description); + auto retVal = mSocket->Write(buffer, size); + free(buffer); + return retVal; } // todo serialize the data