fix message数量过多导致int溢出 (#2014)

Co-authored-by: 角弓 <jiaogong.lzh@alibaba-inc.com>
This commit is contained in:
navi
2024-12-26 17:29:48 +08:00
committed by GitHub
parent cada3f5cb0
commit 88df42a60f

View File

@@ -52,7 +52,7 @@ struct skynet_context {
uint32_t handle; uint32_t handle;
int session_id; int session_id;
ATOM_INT ref; ATOM_INT ref;
int message_count; size_t message_count;
bool init; bool init;
bool endless; bool endless;
bool profile; bool profile;
@@ -574,7 +574,7 @@ cmd_stat(struct skynet_context * context, const char * param) {
strcpy(context->result, "0"); strcpy(context->result, "0");
} }
} else if (strcmp(param, "message") == 0) { } else if (strcmp(param, "message") == 0) {
sprintf(context->result, "%d", context->message_count); sprintf(context->result, "%zu", context->message_count);
} else { } else {
context->result[0] = '\0'; context->result[0] = '\0';
} }