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>
This commit is contained in:
parent
6b929abe69
commit
2f324e770f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue