diff --git a/0015-If-do_beep-sees-error-from-API-exit-program.patch b/0015-If-do_beep-sees-error-from-API-exit-program.patch new file mode 100644 index 0000000..a91c4aa --- /dev/null +++ b/0015-If-do_beep-sees-error-from-API-exit-program.patch @@ -0,0 +1,39 @@ +From d419a0daa59a3afbbc14354feed2701ed2109afb Mon Sep 17 00:00:00 2001 +From: Hans Ulrich Niedermann +Date: Fri, 28 Dec 2018 06:01:10 +0100 +Subject: [PATCH] If do_beep() sees error from API, exit program + +--- + beep.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/beep.c b/beep.c +index 2a7404e..1b9d8ca 100644 +--- a/beep.c ++++ b/beep.c +@@ -114,7 +114,11 @@ void do_beep(unsigned int freq) { + switch (console_type) { + case BEEP_TYPE_CONSOLE: if (1) { + const uintptr_t argp = ((freq != 0) ? (CLOCK_TICK_RATE/freq) : freq) & 0xffff; +- (void) ioctl(console_fd, KIOCSOUND, argp); ++ if (-1 == ioctl(console_fd, KIOCSOUND, argp)) { ++ /* If we cannot use the sound API, we cannot silence the sound either */ ++ perror("ioctl KIOCSOUND"); ++ exit(1); ++ } + } + break; + case BEEP_TYPE_EVDEV: if (1) { +@@ -125,7 +129,11 @@ void do_beep(unsigned int freq) { + e.code = SND_TONE; + e.value = freq; + +- (void) write(console_fd, &e, sizeof(struct input_event)); ++ if (sizeof(e) != write(console_fd, &e, sizeof(e))) { ++ /* If we cannot use the sound API, we cannot silence the sound either */ ++ perror("write EV_SND"); ++ exit(1); ++ } + } + break; + case BEEP_TYPE_UNSET: diff --git a/beep.spec b/beep.spec index 2570038..a31d1d5 100644 --- a/beep.spec +++ b/beep.spec @@ -70,6 +70,10 @@ Patch13: 0013-Fix-CVE-2018-1000532-and-mitigate-against-related-is.patch # Update COPYING with new FSF address Patch14: 0014-Update-COPYING-with-new-FSF-address.patch +# If do_beep() sees error from API, exit program +Patch15: 0015-If-do_beep-sees-error-from-API-exit-program.patch + + BuildRequires: gcc BuildRequires: glibc-kernheaders @@ -98,6 +102,7 @@ rm -f beep.1.gz %patch12 -p1 -b 0012 %patch13 -p1 -b 0013 %patch14 -p1 -b 0014 +%patch15 -p1 -b 0015 cp -p %{SOURCE1} README.fedora @@ -137,6 +142,7 @@ install -p -m 0644 %{SOURCE4} %{SOURCE5} "$RPM_BUILD_ROOT/%{_sysconfdir}/profile - Update COPYING with new FSF address - Fix Patch9 to work as non-git patch (do the rest with shell) - Proper naming of Patch14 +- Exit beep when error accessing API * Fri Dec 28 2018 Hans Ulrich Niedermann - 1.3-23 - Fix CVE-2018-1000532 and mitigate against related issues (#1595592)