38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
From 263fdc6b067bd892df654377c0ea051289fce33f Mon Sep 17 00:00:00 2001
|
|
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
|
|
Date: Mon, 6 Jun 2022 20:15:03 -0600
|
|
Subject: [PATCH] Fix issue protobuf-c#499: unsigned integer overflow
|
|
Signed-off-by: 10054172 <hui.zhang@thalesgroup.com>
|
|
|
|
---
|
|
lib/protobuf-c/protobuf-c.c | 13 ++++++++-----
|
|
1 file changed, 8 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/lib/protobuf-c/protobuf-c.c b/lib/protobuf-c/protobuf-c.c
|
|
index 96b750650..73e120046 100644
|
|
--- a/lib/protobuf-c/protobuf-c.c
|
|
+++ b/lib/protobuf-c/protobuf-c.c
|
|
@@ -2619,11 +2619,14 @@ parse_required_member(ScannedMember *scanned_member,
|
|
return FALSE;
|
|
|
|
def_mess = scanned_member->field->default_value;
|
|
- subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
|
|
- allocator,
|
|
- len - pref_len,
|
|
- data + pref_len);
|
|
-
|
|
+ if (len > pref_len) {
|
|
+ subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
|
|
+ allocator,
|
|
+ len - pref_len,
|
|
+ data + pref_len);
|
|
+ } else {
|
|
+ subm = NULL;
|
|
+ }
|
|
if (maybe_clear &&
|
|
*pmessage != NULL &&
|
|
*pmessage != def_mess)
|
|
--
|
|
2.33.0
|
|
|