summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-02-15 17:34:07 +0100
committerGravatar Jonathan Beck2009-02-15 17:34:07 +0100
commit480fd72fc285fc4f42a7618147cce646ba337ebe (patch)
tree33c6d3d1ddfb27370e512b28a2cf5144e3f1094e
parentbb3097cb2266b55719b955c93d09a0e2d6f8eccb (diff)
downloadlibplist-480fd72fc285fc4f42a7618147cce646ba337ebe.tar.gz
libplist-480fd72fc285fc4f42a7618147cce646ba337ebe.tar.bz2
Do not write 3 byte integer nodes. Use standard 4bytes integer instead.
-rw-r--r--src/bplist.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bplist.c b/src/bplist.c
index cf9b9c6..1ab3ab8 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -589,7 +589,11 @@ static gboolean free_index(gpointer key, gpointer value, gpointer user_data)
static void write_int(GByteArray * bplist, uint64_t val)
{
uint64_t size = get_needed_bytes(val);
- uint8_t *buff = (uint8_t *) malloc(sizeof(uint8_t) + size);
+ uint8_t *buff = NULL;
+ //do not write 3bytes int node
+ if (size == 3)
+ size++;
+ buff = (uint8_t *) malloc(sizeof(uint8_t) + size);
buff[0] = BPLIST_UINT | Log2(size);
memcpy(buff + 1, &val, size);
byte_convert(buff + 1, size);