mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +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;
|
break;
|
||||||
case BSON_STRING: {
|
case BSON_STRING: {
|
||||||
int sz = read_int32(L, &t);
|
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);
|
lua_pushlstring(L, read_bytes(L, &t, sz), sz-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -804,6 +807,9 @@ lreplace(lua_State *L) {
|
|||||||
write_int64(&b, i);
|
write_int64(&b, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
luaL_error(L, "Can't replace type %d", type);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user