diff options
author | tobhe <tobhe@cvs.openbsd.org> | 2020-09-29 14:51:41 +0000 |
---|---|---|
committer | tobhe <tobhe@cvs.openbsd.org> | 2020-09-29 14:51:41 +0000 |
commit | f14011a75f72dc14f34a91a3b5c21a35e6b45f24 (patch) | |
tree | c471383b5a34ed72e202b2134f5b761a458aba3d /sbin/iked/ikev2_pld.c | |
parent | 01acb58b8a1691f5c44531ef7f8199ae39208aba (diff) |
Check ibuf_seek() return value.
ok patrick@
Diffstat (limited to 'sbin/iked/ikev2_pld.c')
-rw-r--r-- | sbin/iked/ikev2_pld.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c index 7102cfff6fd..82a77a0aeaf 100644 --- a/sbin/iked/ikev2_pld.c +++ b/sbin/iked/ikev2_pld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_pld.c,v 1.96 2020/09/21 20:13:49 tobhe Exp $ */ +/* $OpenBSD: ikev2_pld.c,v 1.97 2020/09/29 14:51:40 tobhe Exp $ */ /* * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de> @@ -1793,6 +1793,7 @@ ikev2_frags_reassemble(struct iked *env, struct ikev2_payload *pld, struct iked_frag *sa_frag = &msg->msg_sa->sa_fragments; struct ibuf *e = NULL; struct iked_frag_entry *el; + uint8_t *ptr; size_t offset; size_t i; struct iked_message emsg; @@ -1809,7 +1810,12 @@ ikev2_frags_reassemble(struct iked *env, struct ikev2_payload *pld, for (i = 0; i < sa_frag->frag_total; i++) { if ((el = sa_frag->frag_arr[i]) == NULL) fatalx("Tried to reassemble shallow frag_arr"); - memcpy(ibuf_seek(e, offset, 0), el->frag_data, el->frag_size); + ptr = ibuf_seek(e, offset, el->frag_size); + if (ptr == NULL) { + log_info("%s: failed to reassemble fragments", __func__); + goto done; + } + memcpy(ptr, el->frag_data, el->frag_size); offset += el->frag_size; } |