bson-based boardinfo working

This commit is contained in:
px4dev
2012-10-29 18:00:32 -07:00
parent 3420e7b828
commit 7203ba797e
2 changed files with 233 additions and 3 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ bson_decoder_init_buf(bson_decoder_t decoder, void *buf, unsigned bufsize, bson_
/* read and discard document size */
if (read_int32(decoder, &len))
CODER_KILL(decoder, "failed reading length");
if (len > (int)bufsize)
if ((len > 0) && (len > (int)bufsize))
CODER_KILL(decoder, "document length larger than buffer");
/* ready for decoding */