qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ui/vnc: Fix problem with sending too many bytes


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH] ui/vnc: Fix problem with sending too many bytes as server name
Date: Tue, 22 Nov 2016 08:12:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 21.11.2016 18:51, Gerd Hoffmann wrote:
> On Mo, 2016-11-21 at 18:25 +0100, Thomas Huth wrote:
>> If the buffer is not big enough, snprintf() does not return the number
>> of bytes that have been written to the buffer, but the number of bytes
>> that would be needed for writing the whole string. By using this value
>> for the following vnc_write() calls, we send some junk at the end of
>> the name in case the qemu_name is longer than 1017 bytes, which could
>> confuse the VNC clients. Fix this by adding an additional size check
>> here.
> 
> Use g_strdup_printf instead?

Not sure ... If I'd use g_strdup_printf instead here, we might end up
with a string that is bigger than 1024 bytes here. Maybe there is/was a
reason that the string is limited to 1024 bytes here? Are there clients
that can not deal with more that 1024 bytes?
So unless you feel very confident that it does not matter, using the
size check instead of g_strdup_printf sounds like the less invasive
solution to me.

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]