Recent Match - Possible memory leaks + Possible buffer overflow with strncpy()
Subsystems (2)
PATCH 1/1 Recent Match - Possible memory leaks + Possible buffer overflow with strncpy()
Folks,
the attached patch fixes for the recent match two issues:
1- using strncpy() does not garantee that the destination string will be NULL-terminated
2- If a vmalloc() fails, the previously allocated memory blocks are not freed.
Enjoy !
include/linux/netfilter_ipv4/ipt_recent.h +3 -1
@@ -1,6 +1,8 @@#ifndef _IPT_RECENT_H#define _IPT_RECENT_H +#define NAME_LEN 200 +const static int IPT_RECENT_CHECK =1 ;const static int IPT_RECENT_SET =2 ;const static int IPT_RECENT_UPDATE =4 ;
@@ -15,7 +17,7 @@u_int32_t hit_count;u_int8_t check_set;u_int8_t invert; -char name[200 ]; +char name[NAME_LEN ];u_int8_t side; };
net/ipv4/netfilter/ipt_recent.c +36 -20
135 lines not on this page · raw message