aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-05-05 21:53:36 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-05-08 20:44:41 +0200
commitd55275d6033e5936b6d9ff72eb553d7709d0d4b3 (patch)
tree455798828a331c4d20d24d543d7eea69383de1f6
parent2d77af94c6dda78bc134bfb3a538dfda72ecc2c5 (diff)
downloadtdv-d55275d6033e5936b6d9ff72eb553d7709d0d4b3.tar.gz
tdv-d55275d6033e5936b6d9ff72eb553d7709d0d4b3.tar.xz
tdv-d55275d6033e5936b6d9ff72eb553d7709d0d4b3.zip
Be a bit more robust, fix data entries
-rw-r--r--stardict.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/stardict.c b/stardict.c
index 3e1fd55..471ab62 100644
--- a/stardict.c
+++ b/stardict.c
@@ -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;
}