summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2024-04-02 12:22:39 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2024-04-02 12:22:39 +0000
commitc70b8e1c48fbf82d72fb9dc03cc862ea7a64fbd1 (patch)
tree6c547bc9fb5fbce10b7837b6f062f74787b24d54
parentdf78d2316c4fff13f0e2f1612cfde1e0a9d8388a (diff)
Oops, incorrect hex conversion spotted by claudio. While here try to
improve how it reads a bit better. Surprising the regression tests didn't spot this error, maybe it fails to roundtrip the values.
-rw-r--r--usr.bin/ssh/ssh-pkcs11.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-pkcs11.c b/usr.bin/ssh/ssh-pkcs11.c
index 69bff22f07a..e6c53f00e02 100644
--- a/usr.bin/ssh/ssh-pkcs11.c
+++ b/usr.bin/ssh/ssh-pkcs11.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11.c,v 1.61 2024/04/02 09:48:24 claudio Exp $ */
+/* $OpenBSD: ssh-pkcs11.c,v 1.62 2024/04/02 12:22:38 deraadt Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
* Copyright (c) 2014 Pedro Martelletto. All rights reserved.
@@ -1364,14 +1364,13 @@ static int
h2i(char c)
{
if (c >= '0' && c <= '9')
- c -= '0';
+ return c - '0';
else if (c >= 'a' && c <= 'f')
- c -= 'a';
+ return c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
- c -= 'A';
+ return c - 'A' + 10;
else
return -1;
- return c;
}
static int