Fix String overflow warning
Scanner Output
--------------
rror: COMPILER_WARNING (CWE-758): [#def2]
libtasn1-4.16.0/lib/element.c: scope_hint: In function '_asn1_append_sequence_set'
libtasn1-4.16.0/lib/element.c:186:7: warning[-Wstringop-overflow=]: '_asn1_ltostr' accessing 22 bytes in a region of size 21
# 186 | _asn1_ltostr (n, temp + 1);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~
libtasn1-4.16.0/lib/element.c:186:7: note: referencing argument 2 of type 'char *'
libtasn1-4.16.0/lib/element.c:30: included_from: Included from here.
libtasn1-4.16.0/lib/parser_aux.h:70:7: note: in a call to function '_asn1_ltostr'
# 70 | char *_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]);
# | ^~~~~~~~~~~~
# 184| n++;
# 185| temp[0] = '?';
# 186|-> _asn1_ltostr (n, temp + 1);
# 187| }
# 188| _asn1_set_name (p2, temp);
Signed-off-by: Simo Sorce <simo@redhat.com>
diff --git a/lib/element.c b/lib/element.c
index c4e5180..550fdb2 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -142,7 +142,7 @@
_asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache)
{
asn1_node p, p2;
- char temp[LTOSTR_MAX_SIZE];
+ char temp[LTOSTR_MAX_SIZE+1];
long n;
if (!node || !(node->down))