fixed possibility of panic at key_acquire().
key_acquire() does not require a secpolicy structure. Obtained from: KAME
This commit is contained in:
parent
18941d4ee0
commit
6ea140035b
@ -5513,19 +5513,16 @@ key_acquire(saidx, sp)
|
||||
#ifndef IPSEC_NONBLOCK_ACQUIRE
|
||||
struct secacq *newacq;
|
||||
#endif
|
||||
struct secpolicyindex *spidx = NULL;
|
||||
u_int8_t satype;
|
||||
int error = -1;
|
||||
u_int32_t seq;
|
||||
|
||||
/* sanity check */
|
||||
if (saidx == NULL || sp == NULL)
|
||||
if (saidx == NULL)
|
||||
panic("key_acquire: NULL pointer is passed.\n");
|
||||
if ((satype = key_proto2satype(saidx->proto)) == 0)
|
||||
panic("key_acquire: invalid proto is passed.\n");
|
||||
|
||||
spidx = &sp->spidx;
|
||||
|
||||
#ifndef IPSEC_NONBLOCK_ACQUIRE
|
||||
/*
|
||||
* We never do anything about acquirng SA. There is anather
|
||||
@ -5588,12 +5585,14 @@ key_acquire(saidx, sp)
|
||||
/* XXX proxy address (optional) */
|
||||
|
||||
/* set sadb_x_policy */
|
||||
m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
|
||||
if (!m) {
|
||||
error = ENOBUFS;
|
||||
goto fail;
|
||||
if (sp) {
|
||||
m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
|
||||
if (!m) {
|
||||
error = ENOBUFS;
|
||||
goto fail;
|
||||
}
|
||||
m_cat(result, m);
|
||||
}
|
||||
m_cat(result, m);
|
||||
|
||||
/* XXX identity (optional) */
|
||||
#if 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user