]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Oops, incorrect hex conversion spotted by claudio.
authorderaadt@openbsd.org <deraadt@openbsd.org>
Tue, 2 Apr 2024 12:22:38 +0000 (12:22 +0000)
committerDamien Miller <djm@mindrot.org>
Tue, 30 Apr 2024 02:16:54 +0000 (12:16 +1000)
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.

OpenBSD-Commit-ID: 866cfcc1955aef8f3fc32da0b70c353a1b859f2e

ssh-pkcs11.c

index de2dbba56f0e8b5d50a6e1717d9050b001097fc5..1e76e8b2bb3ab82d3d5bfcbea75e10adfa51681e 100644 (file)
@@ -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.
@@ -1389,14 +1389,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