8c6b1ac71e
Also include some minor fixes for gcc 5.1.1 Signed-off-by: Peter Jones <pjones@redhat.com>
62 lines
1.8 KiB
Diff
62 lines
1.8 KiB
Diff
From 44461d5af23dc00bf31604fa07e191b0d4c5cb67 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
Date: Tue, 20 Jan 2015 14:11:32 +0100
|
|
Subject: [PATCH 141/506] grub_cmd_play: Avoid division by zero.
|
|
|
|
---
|
|
ChangeLog | 5 +++++
|
|
grub-core/commands/i386/pc/play.c | 15 +++++++++++++++
|
|
2 files changed, 20 insertions(+)
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index 1428477..3ae00de 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,5 +1,10 @@
|
|
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
+ * grub-core/commands/i386/pc/play.c (grub_cmd_play): Avoid
|
|
+ division by zero.
|
|
+
|
|
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
|
|
+
|
|
* grub-core/bus/usb/usbtrans.c (grub_usb_bulk_maxpacket): Avoid
|
|
potentially returning 0.
|
|
|
|
diff --git a/grub-core/commands/i386/pc/play.c b/grub-core/commands/i386/pc/play.c
|
|
index 40798c9..7712e2a 100644
|
|
--- a/grub-core/commands/i386/pc/play.c
|
|
+++ b/grub-core/commands/i386/pc/play.c
|
|
@@ -107,6 +107,14 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|
return grub_errno;
|
|
}
|
|
|
|
+ if (!tempo)
|
|
+ {
|
|
+ grub_file_close (file);
|
|
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
|
|
+ args[0]);
|
|
+ return grub_errno;
|
|
+ }
|
|
+
|
|
tempo = grub_le_to_cpu32 (tempo);
|
|
grub_dprintf ("play","tempo = %d\n", tempo);
|
|
|
|
@@ -131,6 +139,13 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
tempo = grub_strtoul (args[0], &end, 0);
|
|
|
|
+ if (!tempo)
|
|
+ {
|
|
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
|
|
+ args[0]);
|
|
+ return grub_errno;
|
|
+ }
|
|
+
|
|
if (*end)
|
|
/* Was not a number either, assume it was supposed to be a file name. */
|
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);
|
|
--
|
|
2.4.3
|
|
|