There was a few places where pointer was used and then checked against null.
This patch is trying to fix that by adding additional checks or moving it into the right place. Signed-off-by: Sviatoslav Mikhailov <svi...@mail.ru> --- src/openvpn/buffer.c | 2 +- src/openvpn/ps.c | 4 ++-- src/openvpn/push.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 52c6ab9..57956dd 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -439,7 +439,7 @@ format_hex_ex (const uint8_t *data, int size, int maxoutput, struct gc_arena *gc) { struct buffer out = alloc_buf_gc (maxoutput ? maxoutput : - ((size * 2) + (size / (space_break_flags & FHE_SPACE_BREAK_MASK)) * (int) strlen (separator) + 2), + ((size * 2) + (size / (space_break_flags & FHE_SPACE_BREAK_MASK)) * (separator ? (int) strlen (separator) : 0) + 2), gc); int i; for (i = 0; i < size; ++i) diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index 2cb68f1..935bd0b 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -499,6 +499,7 @@ control_message_from_parent (const socket_descriptor_t sd_control, mesg.msg_flags = 0; h = CMSG_FIRSTHDR(&mesg); + ASSERT (h); h->cmsg_len = CMSG_LEN(sizeof(socket_descriptor_t)); h->cmsg_level = SOL_SOCKET; h->cmsg_type = SCM_RIGHTS; @@ -508,8 +509,7 @@ control_message_from_parent (const socket_descriptor_t sd_control, status = recvmsg (sd_control, &mesg, MSG_NOSIGNAL); if (status != -1) { - if ( h == NULL - || h->cmsg_len != CMSG_LEN(sizeof(socket_descriptor_t)) + if ( h->cmsg_len != CMSG_LEN(sizeof(socket_descriptor_t)) || h->cmsg_level != SOL_SOCKET || h->cmsg_type != SCM_RIGHTS ) { diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 9953079..b016d99 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -565,7 +565,7 @@ push_remove_option (struct options *o, const char *p) msg (D_PUSH_DEBUG, "PUSH_REMOVE searching for: '%s'", p); /* ifconfig-ipv6 is special, as not part of the push list */ - if ( streq( p, "ifconfig-ipv6" )) + if (o && streq( p, "ifconfig-ipv6" )) { o->push_ifconfig_ipv6_blocked = true; return; -- 1.7.10.msysgit.1 ------------------------------------------------------------------------------ _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel