summaryrefslogtreecommitdiff
path: root/sbin/iked/pfkey.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-04-25 09:41:22 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-04-25 09:41:22 +0000
commita2167dc48eac0fc606f8e40068626fa2a506cfc4 (patch)
tree7c972d30ce648accda5c19b003143bc9a1b1d2ac /sbin/iked/pfkey.c
parent8daad1511f22b704ab28ddc2569b194327728018 (diff)
don't access a pointer till after the null check
ok mikeb@
Diffstat (limited to 'sbin/iked/pfkey.c')
-rw-r--r--sbin/iked/pfkey.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/iked/pfkey.c b/sbin/iked/pfkey.c
index 09f1626b4ac..69c76a8b7ca 100644
--- a/sbin/iked/pfkey.c
+++ b/sbin/iked/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.29 2014/02/21 20:52:38 markus Exp $ */
+/* $OpenBSD: pfkey.c,v 1.30 2014/04/25 09:41:21 jsg Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -1521,7 +1521,7 @@ pfkey_process(struct iked *env, struct pfkey_message *pm)
struct sadb_x_policy sa_pol;
struct sockaddr *ssrc, *sdst, *smask, *dmask, *speer;
struct iovec iov[IOV_CNT];
- int iov_cnt, sd = env->sc_pfkey;
+ int iov_cnt, sd;
u_int8_t *reply;
ssize_t rlen;
const char *errmsg = NULL;
@@ -1532,6 +1532,7 @@ pfkey_process(struct iked *env, struct pfkey_message *pm)
if (!env || !data || !len)
return;
+ sd = env->sc_pfkey;
hdr = (struct sadb_msg *)data;
switch (hdr->sadb_msg_type) {