44 lines
1.2 KiB
Diff
44 lines
1.2 KiB
Diff
From e34f0793b641998eb4f9bedb4f7929bb0e3051b8 Mon Sep 17 00:00:00 2001
|
|
From: Bart Van Assche <bvanassche@acm.org>
|
|
Date: Sun, 6 Sep 2020 15:13:58 -0700
|
|
Subject: [PATCH] libsnmp: Allocate the module import list on the heap
|
|
|
|
Since that list occupies 8 KiB, allocate it on the heap instead of on the
|
|
stack.
|
|
---
|
|
snmplib/parse.c | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/snmplib/parse.c b/snmplib/parse.c
|
|
index 27b37a1..e1609cc 100644
|
|
--- a/snmplib/parse.c
|
|
+++ b/snmplib/parse.c
|
|
@@ -3637,13 +3637,15 @@ parse_imports(FILE * fp)
|
|
char token[MAXTOKEN];
|
|
char modbuf[256];
|
|
#define MAX_IMPORTS 512
|
|
- struct module_import import_list[MAX_IMPORTS];
|
|
+ struct module_import *import_list;
|
|
int this_module;
|
|
struct module *mp;
|
|
|
|
int import_count = 0; /* Total number of imported descriptors */
|
|
int i = 0, old_i; /* index of first import from each module */
|
|
|
|
+ import_list = malloc(MAX_IMPORTS * sizeof(*import_list));
|
|
+
|
|
type = get_token(fp, token, MAXTOKEN);
|
|
|
|
/*
|
|
@@ -3732,6 +3734,7 @@ parse_imports(FILE * fp)
|
|
print_module_not_found(module_name(current_module, modbuf));
|
|
|
|
out:
|
|
+ free(import_list);
|
|
return;
|
|
}
|
|
|
|
--
|
|
1.8.3.1
|
|
|