cve-test-suite: tweak cve-2018-6836 test
This commit is contained in:
parent
d5ac00e1d4
commit
e9ddf4ddeb
|
@ -1,28 +1,30 @@
|
||||||
|
// Bug: free uninitialized pointer
|
||||||
|
// Fix: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=28960d79cca262ac6b974f339697b299a1e28fef
|
||||||
|
|
||||||
void *malloc(unsigned long);
|
void *malloc(unsigned long);
|
||||||
void free(void *);
|
void free(void *);
|
||||||
|
|
||||||
struct comment {
|
struct comment {
|
||||||
int *p;
|
int *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct table {
|
struct table {
|
||||||
struct comment *p;
|
struct comment *com;
|
||||||
};
|
};
|
||||||
|
|
||||||
void delete_table(struct table *t)
|
void destroy_table(struct table *comment_table)
|
||||||
{
|
{
|
||||||
free(t->p->p);
|
free(comment_table->com->data);
|
||||||
free(t->p);
|
free(comment_table->com);
|
||||||
free(t);
|
free(comment_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void f()
|
void f()
|
||||||
{
|
{
|
||||||
struct table *t = (struct table *)malloc(sizeof(struct table));
|
struct table *comment_table = (struct table *)malloc(sizeof(struct table));
|
||||||
struct comment *comment_rec = (struct comment *)malloc(sizeof(struct comment));
|
struct comment *comment_rec = (struct comment *)malloc(sizeof(struct comment));
|
||||||
t->p = comment_rec;
|
comment_table->com = comment_rec;
|
||||||
delete_table(t);
|
destroy_table(comment_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue