x509asn1: suppress left shift on signed value

Use an unsigned variable: as the signed operation behavior is undefined,
this change silents clang-tidy about it.

Ref: https://github.com/curl/curl/pull/3163
Reported-By: Daniel Stenberg
This commit is contained in:
Patrick Monnerat 2018-10-27 15:04:50 +02:00
Родитель 3793761a37
Коммит c335b7f1f7
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -223,7 +223,7 @@ static const char *bit2str(const char *beg, const char *end)
static const char *int2str(const char *beg, const char *end)
{
long val = 0;
unsigned long val = 0;
size_t n = end - beg;
/* Convert an ASN.1 integer value into its string representation.
@ -243,7 +243,7 @@ static const char *int2str(const char *beg, const char *end)
do
val = (val << 8) | *(const unsigned char *) beg++;
while(beg < end);
return curl_maprintf("%s%lx", (val < 0 || val >= 10)? "0x": "", val);
return curl_maprintf("%s%lx", val >= 10? "0x": "", val);
}
static ssize_t