Skip to content

Commit fa492f0

Browse files
committed
Fix a signedness mistake in secp256k1_num_set_hex
We were using a potentially signed char as index in an array.
1 parent e2beb0b commit fa492f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/num_gmp_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void static secp256k1_num_set_hex(secp256k1_num_t *r, const char *a, int alen) {
300300
};
301301
unsigned char num[257] = {};
302302
for (int i=0; i<alen; i++) {
303-
num[i] = cvt[a[i]];
303+
num[i] = cvt[(unsigned char)a[i]];
304304
}
305305
r->limbs = mpn_set_str(r->data, num, alen, 16);
306306
while (r->limbs > 1 && r->data[r->limbs-1] == 0) r->limbs--;

0 commit comments

Comments
 (0)