grub2/0142-grub-core-disk-AFSplitter.c-AF_merge-Check-that-mdle.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

42 lines
1.2 KiB
Diff

From 1dfe3f973e83b33badeee1c1f7d2644401294d8c Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 14:12:30 +0100
Subject: [PATCH 142/506] * grub-core/disk/AFSplitter.c (AF_merge): Check that
mdlen is not 0.
---
ChangeLog | 4 ++++
grub-core/disk/AFSplitter.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 3ae00de..0c85b35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0.
+
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/commands/i386/pc/play.c (grub_cmd_play): Avoid
division by zero.
diff --git a/grub-core/disk/AFSplitter.c b/grub-core/disk/AFSplitter.c
index d76a1c4..7e1bd57 100644
--- a/grub-core/disk/AFSplitter.c
+++ b/grub-core/disk/AFSplitter.c
@@ -76,7 +76,7 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst,
if (bufblock == NULL)
return GPG_ERR_OUT_OF_MEMORY;
- if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
+ if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0)
return GPG_ERR_INV_ARG;
grub_memset (bufblock, 0, blocksize);
--
2.4.3