mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bson : check string length
This commit is contained in:
@@ -532,6 +532,9 @@ unpack_dict(lua_State *L, struct bson_reader *br, bool array) {
|
||||
break;
|
||||
case BSON_STRING: {
|
||||
int sz = read_int32(L, &t);
|
||||
if (sz == 0) {
|
||||
luaL_error(L, "Invalid bson string , length = 0");
|
||||
}
|
||||
lua_pushlstring(L, read_bytes(L, &t, sz), sz-1);
|
||||
break;
|
||||
}
|
||||
@@ -804,6 +807,9 @@ lreplace(lua_State *L) {
|
||||
write_int64(&b, i);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
luaL_error(L, "Can't replace type %d", type);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user