These buffers in tvb_uncompress() can't ovelaps, so use optimized memcpy().

svn path=/trunk/; revision=41870
This commit is contained in:
Jakub Zawadzki 2012-03-31 12:35:07 +00:00
parent 60f47ed05b
commit 35eae45497
1 changed files with 3 additions and 4 deletions

View File

@ -3323,15 +3323,14 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
* when uncompr is NULL logic below doesn't create tvb
* which is later interpreted as decompression failed.
*/
uncompr = (bytes_pass || ret != Z_STREAM_END) ?
uncompr = (bytes_pass || err != Z_STREAM_END) ?
g_memdup(strmbuf, bytes_pass) :
g_strdup("");
} else {
guint8 *new_data = g_malloc0(bytes_out + bytes_pass);
g_memmove(new_data, uncompr, bytes_out);
g_memmove((new_data + bytes_out), strmbuf,
bytes_pass);
memcpy(new_data, uncompr, bytes_out);
memcpy(new_data + bytes_out, strmbuf, bytes_pass);
g_free(uncompr);
uncompr = new_data;