From f11db3c7fc50b0b7de22e5ccdcb06bcbccb22a46 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Mon, 6 Apr 2015 19:25:02 +0300 Subject: [PATCH] core: avoid NULL derefrence in grub_divmod64s It can be called with NULL for third argument. grub_divmod32* for now are called only from within wrappers, so skip check. Reported-By: Michael Zimmermann --- grub-core/lib/division.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/lib/division.c b/grub-core/lib/division.c index 920a79f18..35606fea7 100644 --- a/grub-core/lib/division.c +++ b/grub-core/lib/division.c @@ -50,7 +50,8 @@ grub_divmod64s (grub_int64_t n, q = -q; } /* Now: n = d * q + r */ - *ro = r; + if (ro) + *ro = r; return q; }