ludocode / mpack

MPack - A C encoder/decoder for the MessagePack serialization format / msgpack.org[C]
MIT License
521 stars 82 forks source link

Should NULL data be allowed for mpack_write_str() with count of 0? #96

Closed schmidtw closed 2 years ago

schmidtw commented 2 years ago

I ran into a scenario where I'm hitting an assert (linked below) in mpack_write_str() when I pass NULL for data and 0 for the count. It seems reasonable to be able to pass this combination. No matter what, the data value shouldn't be dereferenced right?

https://github.com/ludocode/mpack/blob/70627c79632cd52c39147cf489423d19f2d66a18/src/mpack/mpack-writer.c#L1249

ludocode commented 2 years ago

(See discussion in #97.) Thanks!