1
0
mirror of https://github.com/fumiama/simple-protobuf.git synced 2026-06-05 08:20:25 +08:00

修复段错误

This commit is contained in:
fumiama
2021-06-08 14:55:24 +08:00
parent fdf5dd54b0
commit 8db2ae8e7d

View File

@@ -37,7 +37,7 @@ SIMPLE_PB* get_pb(FILE* fp) {
uint32_t init_pos = ftell(fp);
uint32_t struct_len = read_num(fp);
if(struct_len > 1) {
SIMPLE_PB* spb = malloc(struct_len + sizeof(uint32_t));
SIMPLE_PB* spb = malloc(struct_len + 2 * sizeof(uint32_t));
if(spb) {
spb->struct_len = struct_len;
spb->real_len = 0;