commit 261a210b36263008d2959e6e561cc92c5cf4a41c parent 923a9b5a7aede64a76e399d9880368f0a1e7e9bf Author: geeknik <466878+geeknik@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:35:14 +0000 Fix potential crashes in char_to_hex Co-authored-by: William Casarin <jb55@jb55.com> Fixes: https://github.com/damus-io/nostrdb/issues/10 Diffstat:
M | hex.h | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hex.h b/hex.h @@ -13,9 +13,9 @@ static const char hex_table[256] = { ['E'] = 14, ['F'] = 15 }; -static inline int char_to_hex(unsigned char *val, int c) +static inline int char_to_hex(unsigned char *val, unsigned char c) { - if (hex_table[(int)c] || c == '0') { + if (hex_table[c] || c == '0') { *val = hex_table[c]; return 1; }