aboutsummaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-06-05 01:21:48 +0000
committerNIIBE Yutaka <[email protected]>2025-06-05 01:24:07 +0000
commit27e6622322b53740175530de808643e72242f740 (patch)
tree22ffbe46595804ba81c232b8e2cedb5151a2c7a0 /scd
parentscd: Fix detecting digest OID in the message to be signed. (diff)
downloadgnupg-27e6622322b53740175530de808643e72242f740.tar.gz
gnupg-27e6622322b53740175530de808643e72242f740.zip
scd: Take care of possible buffer overflow in do_auth.
* scd/app-openpgp.c (do_auth): Check the length in the heuristic. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd')
-rw-r--r--scd/app-openpgp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index cff3ca619..888e23739 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -5641,13 +5641,15 @@ do_auth (app_t app, ctrl_t ctrl, const char *keyidstr,
if (app->app_local->keyattr[2].key_type == KEY_TYPE_ECC)
{
+ /* This is a heuristic to strip off the OID of digest. Fully
+ implemented, it would be use of X macro in do_sign above. */
if (indatalen == 51 || indatalen == 67 || indatalen == 83)
{
const char *p = (const char *)indata + 19;
indata = p;
indatalen -= 19;
}
- else
+ else if (indatalen > 15)
{
const char *p = (const char *)indata + 15;
indata = p;