[Spice-devel] [PATCH] [vd_agent] fix bug: g_key_get_string() is failed when keystring contains '['

Christophe Fergeau cfergeau at redhat.com
Thu Nov 13 07:56:23 PST 2014


Hey, I just realized that this patch and the one for dnd of files with
unicode names were ACK'ed but had never been pushed, this is now done:
http://cgit.freedesktop.org/spice/win32/vd_agent/commit/?id=6c070843cb00635bc8bab5fd98b8fefb597e7557
http://cgit.freedesktop.org/spice/win32/vd_agent/commit/?id=21b79679c1345225ceba8d015f5efe9113d146fb

Sorry it took so much time, and thanks again for the patches!

Christophe

On Mon, Aug 11, 2014 at 08:21:49PM +0800, Cody Chan wrote:
> In vd_agent/file_xfer.cpp, it implemented a simple g_key_get_string,
> but  when dragging a file with a name containing '[' (like te[st.txt), it
> will be failed.
> From source code,
> >next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
> >    if (next_group_pos && key_pos > next_group_pos) return false;
> we know that it tries to find the end of current group by '[' label,
> if we drag a file like te[st.txt, the key_string many like:
> [vdagent-file-xfer]
> name=te[st.txt
> size=10
> so, it's failed when meta parsing and
> returns VD_AGENT_FILE_XFER_STATUS_ERRO message.
> 
> Here's the elegant method Christophe proposed and test ok, thanks for him
> again!
> 
>>> ---
>  vdagent/file_xfer.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
> index 1108369..cec5579 100644
> --- a/vdagent/file_xfer.cpp
> +++ b/vdagent/file_xfer.cpp
> @@ -205,7 +205,7 @@ bool FileXfer::g_key_get_string(char* data, const char*
> group, const char* key,
>      snprintf(key_pfx, sizeof(key_pfx), "\n%s=", key);
>      if (!(key_pos = strstr(group_pos, key_pfx))) return false;
> 
> -    next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
> +    next_group_pos = strstr(group_pos + strlen(group_pfx), "\n[");
>      if (next_group_pos && key_pos > next_group_pos) return false;
> 
>      start = key_pos + strlen(key_pfx);
> --
> 1.9.3​
> 
> -- 
> QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV

> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141113/168f03a1/attachment.sig>


More information about the Spice-devel mailing list