Be a bit more robust, fix data entries

This commit is contained in:
Přemysl Eric Janouch 2013-05-05 21:53:36 +02:00
parent 2d77af94c6
commit d55275d603
1 changed files with 5 additions and 2 deletions

View File

@ -822,10 +822,13 @@ read_entry (gchar type, const gchar **entry_iterator,
GString *data = g_string_new (NULL);
if (is_final)
{
g_string_append_len (data, entry, end - entry);
entry += end - entry;
}
else
{
gchar c;
gint c = EOF;
while (entry < end && (c = *entry++))
g_string_append_c (data, c);
@ -860,7 +863,7 @@ read_entry (gchar type, const gchar **entry_iterator,
sef->type = type;
sef->data_size = length;
sef->data = memcpy (g_malloc (length), entry, length);
*entry_iterator = entry;
*entry_iterator = entry + length;
return sef;
}