git: e755e2776ddf - main - ngatm: Handle errors from uni_msg_extend()
Mark Johnston
markj at FreeBSD.org
Sun Jun 6 20:45:18 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=e755e2776ddff729ae4102f3273473aa33b00077
commit e755e2776ddff729ae4102f3273473aa33b00077
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-06-06 20:42:16 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-06-06 20:44:47 +0000
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
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30611
---
sys/contrib/ngatm/netnatm/msg/uni_ie.c | 6 ++++--
1 file 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);
More information about the dev-commits-src-main
mailing list