aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-06-06 20:42:16 +0000
committerMark Johnston <markj@FreeBSD.org>2021-06-14 20:25:14 +0000
commit09e47586d72f4940eea1e70df706dbc165ad0415 (patch)
treee5156843d9fc7297ecf85b7d906adec41ea6c8d5
parente58cb5c01de989c8f88af3732a5fe404b0660a9c (diff)
downloadsrc-09e47586d72f4940eea1e70df706dbc165ad0415.tar.gz
src-09e47586d72f4940eea1e70df706dbc165ad0415.zip
ngatm: Handle errors from uni_msg_extend()
uni_msg_extend() may fail due to a memory allocation failure. In this case, though, the message is freed, so callers shouldn't touch it. PR: 255861 Reviewed by: harti Sponsored by: The FreeBSD Foundation (cherry picked from commit e755e2776ddff729ae4102f3273473aa33b00077)
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_ie.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/contrib/ngatm/netnatm/msg/uni_ie.c b/sys/contrib/ngatm/netnatm/msg/uni_ie.c
index e4b8310d88d9..3842279c63a1 100644
--- a/sys/contrib/ngatm/netnatm/msg/uni_ie.c
+++ b/sys/contrib/ngatm/netnatm/msg/uni_ie.c
@@ -216,7 +216,8 @@ uni_encode_msg_hdr(struct uni_msg *msg, struct uni_msghdr *h,
{
u_char byte;
- (void)uni_msg_ensure(msg, 9);
+ if (uni_msg_ensure(msg, 9) != 0)
+ return -1;
APP_BYTE(msg, cx->pnni ? PNNI_PROTO : UNI_PROTO);
APP_BYTE(msg, 3);
@@ -654,7 +655,8 @@ uni_encode_ie_hdr(struct uni_msg *msg, enum uni_ietype type,
{
u_char byte;
- (void)uni_msg_ensure(msg, 4 + len);
+ if (uni_msg_ensure(msg, 4 + len) != 0)
+ return -1;
*msg->b_wptr++ = type;
byte = 0x80 | (h->coding << 5);