View | Details | Raw Unified | Return to bug 241010 | Differences between
and this patch

Collapse All | Expand All

(-)key.c (-4 / +6 lines)
Lines 675-681 Link Here
675
static struct mbuf *key_setsadbxsareplay(u_int32_t);
675
static struct mbuf *key_setsadbxsareplay(u_int32_t);
676
static struct mbuf *key_setsadbxpolicy(u_int16_t, u_int8_t,
676
static struct mbuf *key_setsadbxpolicy(u_int16_t, u_int8_t,
677
	u_int32_t, u_int32_t);
677
	u_int32_t, u_int32_t);
678
static struct seckey *key_dup_keymsg(const struct sadb_key *, size_t,
678
static struct seckey *key_dup_keymsg(const struct sadb_key *,
679
    struct malloc_type *);
679
    struct malloc_type *);
680
static struct seclifetime *key_dup_lifemsg(const struct sadb_lifetime *src,
680
static struct seclifetime *key_dup_lifemsg(const struct sadb_lifetime *src,
681
    struct malloc_type *);
681
    struct malloc_type *);
Lines 3412-3418 Link Here
3412
			goto fail;
3412
			goto fail;
3413
		}
3413
		}
3414
3414
3415
		sav->key_auth = key_dup_keymsg(key0, len, M_IPSEC_MISC);
3415
		sav->key_auth = key_dup_keymsg(key0, M_IPSEC_MISC);
3416
		if (sav->key_auth == NULL ) {
3416
		if (sav->key_auth == NULL ) {
3417
			ipseclog((LOG_DEBUG, "%s: No more memory.\n",
3417
			ipseclog((LOG_DEBUG, "%s: No more memory.\n",
3418
				  __func__));
3418
				  __func__));
Lines 3438-3444 Link Here
3438
				error = EINVAL;
3438
				error = EINVAL;
3439
				break;
3439
				break;
3440
			}
3440
			}
3441
			sav->key_enc = key_dup_keymsg(key0, len, M_IPSEC_MISC);
3441
			sav->key_enc = key_dup_keymsg(key0, M_IPSEC_MISC);
3442
			if (sav->key_enc == NULL) {
3442
			if (sav->key_enc == NULL) {
3443
				ipseclog((LOG_DEBUG, "%s: No more memory.\n",
3443
				ipseclog((LOG_DEBUG, "%s: No more memory.\n",
3444
					__func__));
3444
					__func__));
Lines 4064-4076 Link Here
4064
 * OUT: NULL no more memory
4064
 * OUT: NULL no more memory
4065
 */
4065
 */
4066
struct seckey *
4066
struct seckey *
4067
key_dup_keymsg(const struct sadb_key *src, size_t len,
4067
key_dup_keymsg(const struct sadb_key *src,
4068
    struct malloc_type *type)
4068
    struct malloc_type *type)
4069
{
4069
{
4070
	struct seckey *dst;
4070
	struct seckey *dst;
4071
	size_t len;
4071
4072
4072
	dst = malloc(sizeof(*dst), type, M_NOWAIT);
4073
	dst = malloc(sizeof(*dst), type, M_NOWAIT);
4073
	if (dst != NULL) {
4074
	if (dst != NULL) {
4075
		len = src->sadb_key_bits >> 3;
4074
		dst->bits = src->sadb_key_bits;
4076
		dst->bits = src->sadb_key_bits;
4075
		dst->key_data = malloc(len, type, M_NOWAIT);
4077
		dst->key_data = malloc(len, type, M_NOWAIT);
4076
		if (dst->key_data != NULL) {
4078
		if (dst->key_data != NULL) {

Return to bug 241010