kumquat-buildroot/package/mini-snmpd/0002-mib.c-allow-unsigned-integers-to-have-an-extra-byte.patch

29 lines
1.0 KiB
Diff
Raw Normal View History

From 556c8a406c9e08dd9444222e072f7eb9c82a81e8 Mon Sep 17 00:00:00 2001
From: Patrick Rauscher <prauscher@prauscher.de>
Date: Fri, 18 Aug 2017 17:44:32 +0200
Subject: [PATCH] mib.c: allow unsigned integers to have an extra byte
The extra byte can be needed when encoding huge unsigned numbers (i.e. 0x80000000 or higher). In this case, during encoding we need an extra byte to make sure clients decoding as signed int do not get negative numbers. For further details, see commit 949ae648
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
mib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mib.c b/mib.c
index a9ffbe2..83cc20d 100644
--- a/mib.c
+++ b/mib.c
@@ -372,7 +372,7 @@ static int data_alloc(data_t *data, int type)
case BER_TYPE_COUNTER:
case BER_TYPE_GAUGE:
case BER_TYPE_TIME_TICKS:
- data->max_length = sizeof(unsigned int) + 2;
+ data->max_length = sizeof(unsigned int) + 3;
data->encoded_length = 0;
data->buffer = allocate(data->max_length);
break;
--
2.13.2