diff options
author | Michael Mann <mmann78@netscape.net> | 2017-03-28 08:21:55 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-03-28 13:42:21 +0000 |
commit | 2f324e770f0fd58065b9e80d878fd3536897ea81 (patch) | |
tree | dd7a8e4b65d415bdad597152e66f4305906cbd77 | |
parent | 6b929abe6957f4c2cb27760daa1a248ac73c1b88 (diff) |
randpkt_core: Fix a handful of warnings
1. randpkt_core.c(559): warning C6262: Function uses '65596' bytes of stack: exceeds /analyze:stacksize '16384'. Consider moving some data to heap.
2. randpkt_core.c(615): warning C6386: Buffer overrun while writing to 'buffer': the writable size is '65536' bytes, but '-1' bytes might be written.
Change-Id: I0f3bcd19b49d6c8cde0d2ad9f745b14f5462a708
Reviewed-on: https://code.wireshark.org/review/20763
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | randpkt_core/randpkt_core.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c index 3233d625a9..06f9ab910f 100644 --- a/randpkt_core/randpkt_core.c +++ b/randpkt_core/randpkt_core.c @@ -558,25 +558,22 @@ randpkt_example* randpkt_find_example(int type) void randpkt_loop(randpkt_example* example, guint64 produce_count) { - guint i; - int j; + guint i, j; int err; - int len_random; - int len_this_pkt; + guint len_random; + guint len_this_pkt; gchar* err_info; union wtap_pseudo_header* ps_header; - guint8 buffer[65536]; + guint8* buffer; struct wtap_pkthdr* pkthdr; pkthdr = g_new0(struct wtap_pkthdr, 1); + buffer = (guint8*)g_malloc0(65536); pkthdr->rec_type = REC_TYPE_PACKET; pkthdr->presence_flags = WTAP_HAS_TS; pkthdr->pkt_encap = example->sample_wtap_encap; - memset(pkthdr, 0, sizeof(struct wtap_pkthdr)); - memset(buffer, 0, sizeof(buffer)); - ps_header = &pkthdr->pseudo_header; /* Load the sample pseudoheader into our pseudoheader buffer */ @@ -678,6 +675,7 @@ void randpkt_loop(randpkt_example* example, guint64 produce_count) } g_free(pkthdr); + g_free(buffer); } gboolean randpkt_example_close(randpkt_example* example) |