aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2018-10-27 15:04:50 +0200
committerPatrick Monnerat <patrick@monnerat.net>2018-10-27 15:04:50 +0200
commitc335b7f1f7de3b49cb886c3ae12a0384e293832f (patch)
treefb363f0920b252a60a29304d30ed32a8a1e2520a /lib
parent3793761a3777095d643e9f2da951615e1178782c (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/x509asn1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/x509asn1.c b/lib/x509asn1.c
index a0be23d61..c1dcb05c6 100644
--- a/lib/x509asn1.c
+++ b/lib/x509asn1.c
@@ -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