mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
Enforce the compile-time threads limit at run-time, so that a high thread
count argument doesn't cause a segfault or memory corruption when the compile-time array is overrun.
This commit is contained in:
parent
0ee913128d
commit
ce105e8f5a
1 changed files with 4 additions and 0 deletions
|
|
@ -273,6 +273,10 @@ main(int argc, char *argv[])
|
|||
if (argc != 3)
|
||||
usage();
|
||||
|
||||
if (numthreads > MAXTHREADS)
|
||||
errx(-1, "%d exceeds max threads %d", numthreads,
|
||||
MAXTHREADS);
|
||||
|
||||
len = roundup(sizeof(struct state), getpagesize());
|
||||
pagebuffer = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (pagebuffer == MAP_FAILED)
|
||||
|
|
|
|||
Loading…
Reference in a new issue