mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-03 04:30:08 +08:00
tiny_libmaker: fix function array overflow
This commit is contained in:
parent
5818945ef6
commit
c80f81c199
@ -203,8 +203,8 @@ int main(int argc, char **argv)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
funcmax = 1000;
|
funcmax = 250;
|
||||||
afpos = realloc(NULL, funcmax); // 250 func
|
afpos = realloc(NULL, funcmax * sizeof *afpos); // 250 func
|
||||||
memcpy(&arhdro.ar_mode, "100666", 6);
|
memcpy(&arhdro.ar_mode, "100666", 6);
|
||||||
|
|
||||||
//iarg = 1;
|
//iarg = 1;
|
||||||
@ -264,11 +264,11 @@ int main(int argc, char **argv)
|
|||||||
anames = realloc(anames, strpos+istrlen);
|
anames = realloc(anames, strpos+istrlen);
|
||||||
strcpy(anames + strpos, strtab + sym->st_name);
|
strcpy(anames + strpos, strtab + sym->st_name);
|
||||||
strpos += istrlen;
|
strpos += istrlen;
|
||||||
if (funccnt >= funcmax) {
|
if (++funccnt >= funcmax) {
|
||||||
afpos = realloc(NULL, funcmax+1000); // 250 func more
|
funcmax += 250;
|
||||||
funcmax += 1000;
|
afpos = realloc(afpos, funcmax * sizeof *afpos); // 250 func more
|
||||||
}
|
}
|
||||||
afpos[++funccnt] = fpos;
|
afpos[funccnt] = fpos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user