unsigned int chainindex, offset;
STRUCT_ENTRY_TARGET old;
struct chain_cache *c;
+ STRUCT_ENTRY *e;
int ret;
iptc_fn = TC_INSERT_ENTRY;
chainindex = entry2index(*handle, c->start);
- if (index2entry(*handle, chainindex + rulenum) > c->end) {
+ e = index2entry(*handle, chainindex + rulenum);
+ if (!e || e > c->end) {
errno = E2BIG;
return 0;
}
unsigned int chainindex, offset;
STRUCT_ENTRY_TARGET old;
struct chain_cache *c;
+ STRUCT_ENTRY *e;
int ret;
iptc_fn = TC_REPLACE_ENTRY;
chainindex = entry2index(*handle, c->start);
- if (index2entry(*handle, chainindex + rulenum) >= c->end) {
+ e = index2entry(*handle, chainindex + rulenum);
+ if (!e || e >= c->end) {
errno = E2BIG;
return 0;
}