Update 1.1.2

This commit is contained in:
2018-09-12 08:14:17 +09:00
parent a8ed1c4cb9
commit 648f7916df
135 changed files with 688 additions and 233 deletions
+24
View File
@@ -81,6 +81,16 @@ static int uint64_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
return 0;
cp = (char *)*pval;
/*
* Strictly speaking, zero length is malformed. However, long_c2i
* (x_long.c) encodes 0 as a zero length INTEGER (wrongly, of course),
* so for the sake of backward compatibility, we still decode zero
* length INTEGERs as the number zero.
*/
if (len == 0)
goto long_compat;
if (!c2i_uint64_int(&utmp, &neg, &cont, len))
return 0;
if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) {
@@ -95,6 +105,8 @@ static int uint64_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
if (neg)
/* c2i_uint64_int() returns positive values */
utmp = 0 - utmp;
long_compat:
memcpy(cp, &utmp, sizeof(utmp));
return 1;
}
@@ -172,6 +184,16 @@ static int uint32_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
return 0;
cp = (char *)*pval;
/*
* Strictly speaking, zero length is malformed. However, long_c2i
* (x_long.c) encodes 0 as a zero length INTEGER (wrongly, of course),
* so for the sake of backward compatibility, we still decode zero
* length INTEGERs as the number zero.
*/
if (len == 0)
goto long_compat;
if (!c2i_uint64_int(&utmp, &neg, &cont, len))
return 0;
if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) {
@@ -191,6 +213,8 @@ static int uint32_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
return 0;
}
}
long_compat:
utmp2 = (uint32_t)utmp;
memcpy(cp, &utmp2, sizeof(utmp2));
return 1;