summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-01-08 22:19:44 +0100
committerGravatar Jonathan Beck2009-01-08 22:19:44 +0100
commite0b6a20b79e1a438125c72a3335713af01619ea9 (patch)
tree6e984b84d771590e80e6985271a24d9842c1179a /src
parentd174ba080c959cab3245fb1714c6d6340ebbac09 (diff)
downloadlibplist-e0b6a20b79e1a438125c72a3335713af01619ea9.tar.gz
libplist-e0b6a20b79e1a438125c72a3335713af01619ea9.tar.bz2
fix length of basic types while parsing binary plist.
Diffstat (limited to 'src')
-rw-r--r--src/bplist.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c
index b633535..746c13e 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -113,6 +113,8 @@ static plist_t parse_uint_node(char *bnode, uint8_t size, char **next_object)
*next_object = bnode + size;
data->type = PLIST_UINT;
+ data->length = sizeof(uint64_t);
+
return g_node_new(data);
}
@@ -131,6 +133,8 @@ static plist_t parse_real_node(char *bnode, uint8_t size)
return NULL;
}
data->type = PLIST_REAL;
+ data->length = sizeof(double);
+
return g_node_new(data);
}
@@ -143,6 +147,8 @@ static plist_t parse_date_node(char *bnode, uint8_t size)
data->timeval.tv_sec = (glong) time_real;
data->timeval.tv_usec = (time_real - (glong) time_real) * G_USEC_PER_SEC;
data->type = PLIST_DATE;
+ data->length = sizeof(GTimeVal);
+
return node;
}
@@ -154,6 +160,7 @@ static plist_t parse_string_node(char *bnode, uint8_t size)
data->strval = (char *) malloc(sizeof(char) * (size + 1));
memcpy(data->strval, bnode, size);
data->strval[size] = '\0';
+ data->length = strlen(data->strval);
return g_node_new(data);
}
@@ -166,6 +173,7 @@ static plist_t parse_unicode_node(char *bnode, uint8_t size)
data->unicodeval = (wchar_t *) malloc(sizeof(wchar_t) * (size + 1));
memcpy(data->unicodeval, bnode, size);
data->unicodeval[size] = '\0';
+ data->length = wcslen(data->unicodeval);
return g_node_new(data);
}