asn1: Fix a compiler warning with GCC 9.1
Compiling with GCC 9.1, as e.g. happens on AppVeyor, results in the
following warning:
asn1/asn1.c: In function 'asn1_integer':
asn1/asn1.c:871:24: error: '<Ucb40>' may be used uninitialized in this function [-Werror=maybe-uninitialized]
871 | len = content.len + ((*content.ptr & 0x80) ? 1 : 0);
| ^~~~~~~~~~~~
Some experiments showed that the problem was the chunk_from_chars()
assignment. This might be because the temporary chunk_t that was assigned
to the variable was defined in a sub-block, so it might actually be
undefined later when *content.ptr is read.
This commit is contained in:
@@ -851,15 +851,14 @@ chunk_t asn1_bitstring(const char *mode, chunk_t content)
|
||||
*/
|
||||
chunk_t asn1_integer(const char *mode, chunk_t content)
|
||||
{
|
||||
chunk_t object;
|
||||
chunk_t zero = chunk_from_chars(0x00), object;
|
||||
size_t len;
|
||||
u_char *pos;
|
||||
bool move;
|
||||
|
||||
|
||||
if (content.len == 0)
|
||||
{ /* make sure 0 is encoded properly */
|
||||
content = chunk_from_chars(0x00);
|
||||
content = zero;
|
||||
move = FALSE;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user