summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2023-08-26 20:27:48 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2023-08-27 00:46:09 +0100
commit531854eb1cf06aa17419c5c45dead8943153b195 (patch)
tree4860a2270036fef32896c8ddb6bb1ee25b6db44d
parenta1998f2f7ce4153d670e2e5cb5018366517cc1ca (diff)
Fix msgpack sizing blunders
Reminder not to actually use any of the code I write until it's at least been included in a few releases of something. :^)
-rw-r--r--src/chunklets/msg.c6
-rw-r--r--src/chunklets/msg.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/chunklets/msg.c b/src/chunklets/msg.c
index 0e26a80..d99edc1 100644
--- a/src/chunklets/msg.c
+++ b/src/chunklets/msg.c
@@ -197,7 +197,7 @@ void msg_putssz5(unsigned char *out, int sz) {
}
int msg_putssz8(unsigned char *out, int sz) {
- if (sz < 64) { msg_putssz5(out, sz); return 1; }
+ if (sz < 32) { msg_putssz5(out, sz); return 1; }
out[0] = 0xD9;
out[1] = sz;
return 2;
@@ -241,7 +241,7 @@ void msg_putasz4(unsigned char *out, int sz) {
}
int msg_putasz16(unsigned char *out, int sz) {
- if (sz < 32) { msg_putasz4(out, sz); return 1; }
+ if (sz < 16) { msg_putasz4(out, sz); return 1; }
out[0] = 0xDC;
doput16(out, sz);
return 3;
@@ -259,7 +259,7 @@ void msg_putmsz4(unsigned char *out, int sz) {
}
int msg_putmsz16(unsigned char *out, int sz) {
- if (sz < 32) { msg_putmsz4(out, sz); return 1; }
+ if (sz < 16) { msg_putmsz4(out, sz); return 1; }
out[0] = 0xDE;
doput16(out, sz);
return 3;
diff --git a/src/chunklets/msg.h b/src/chunklets/msg.h
index b85bde3..c40bdbe 100644
--- a/src/chunklets/msg.h
+++ b/src/chunklets/msg.h
@@ -162,7 +162,7 @@ void msg_putf(unsigned char *out, float val);
int msg_putd(unsigned char *out, double val);
/*
- * Writes the string size sz in the range [0, 15] to the buffer out. Values
+ * Writes the string size sz in the range [0, 31] to the buffer out. Values
* outside this range will produce an undefined encoding. Always writes a single
* byte.
*