invalid length may nagtive

This commit is contained in:
Cloud Wu
2014-06-04 10:23:49 +08:00
parent 9477cc8171
commit c10e5412c0

View File

@@ -532,8 +532,8 @@ 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");
if (sz <= 0) {
luaL_error(L, "Invalid bson string , length = %d", sz);
}
lua_pushlstring(L, read_bytes(L, &t, sz), sz-1);
break;