Skip to content

Commit c10e541

Browse files
committed
invalid length may nagtive
1 parent 9477cc8 commit c10e541

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lualib-src/lua-bson.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ unpack_dict(lua_State *L, struct bson_reader *br, bool array) {
532532
break;
533533
case BSON_STRING: {
534534
int sz = read_int32(L, &t);
535-
if (sz == 0) {
536-
luaL_error(L, "Invalid bson string , length = 0");
535+
if (sz <= 0) {
536+
luaL_error(L, "Invalid bson string , length = %d", sz);
537537
}
538538
lua_pushlstring(L, read_bytes(L, &t, sz), sz-1);
539539
break;

0 commit comments

Comments
 (0)