mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
add MAX_SLOT_SIZE limit
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define DEFAULT_SLOT_SIZE 4
|
#define DEFAULT_SLOT_SIZE 4
|
||||||
|
#define MAX_SLOT_SIZE 0x40000000
|
||||||
|
|
||||||
struct handle_name {
|
struct handle_name {
|
||||||
char * name;
|
char * name;
|
||||||
@@ -168,6 +169,7 @@ static void
|
|||||||
_insert_name_before(struct handle_storage *s, char *name, uint32_t handle, int before) {
|
_insert_name_before(struct handle_storage *s, char *name, uint32_t handle, int before) {
|
||||||
if (s->name_count >= s->name_cap) {
|
if (s->name_count >= s->name_cap) {
|
||||||
s->name_cap *= 2;
|
s->name_cap *= 2;
|
||||||
|
assert(s->name_cap <= MAX_SLOT_SIZE);
|
||||||
struct handle_name * n = skynet_malloc(s->name_cap * sizeof(struct handle_name));
|
struct handle_name * n = skynet_malloc(s->name_cap * sizeof(struct handle_name));
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<before;i++) {
|
for (i=0;i<before;i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user