]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/beep/0007-Fix-identation-if-brace-error.patch
beep 1.3: Fixes for CVE-2018-0492
[people/pmueller/ipfire-2.x.git] / src / patches / beep / 0007-Fix-identation-if-brace-error.patch
1 From 35ba84dccb8fc8dc43cb3f575904a33ffa27e7b7 Mon Sep 17 00:00:00 2001
2 From: Hans Ulrich Niedermann <hun@n-dimensional.de>
3 Date: Tue, 3 Apr 2018 19:11:07 +0200
4 Subject: [PATCH] Fix indentation/if brace error
5
6 As beep.c is not Python, the code blocks must be defined by
7 using braces instead of just indenting them differently.
8
9 Once we do that, the outcome of multiple -f parameters will
10 actually match what the warning message documents beep does:
11 Only the last -f value will be used.
12
13 Many projects proscribe using braces everywhere, but this
14 change keeps the beep.c coding style of using braces only
15 when absolutely necessary.
16
17 This issue was discovered by compiling with gcc 6.
18 ---
19 beep.c | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22 diff --git a/beep.c b/beep.c
23 index 7da2e70..d46adc8 100644
24 --- a/beep.c
25 +++ b/beep.c
26 @@ -194,11 +194,12 @@ void parse_command_line(int argc, char **argv, beep_parms_t *result) {
27 if(!sscanf(optarg, "%f", &argfreq) || (argfreq >= 20000 /* ack! */) ||
28 (argfreq <= 0))
29 usage_bail(argv[0]);
30 - else
31 + else {
32 if (result->freq != 0)
33 fprintf(stderr, "WARNING: multiple -f values given, only last "
34 "one is used.\n");
35 result->freq = argfreq;
36 + }
37 break;
38 case 'l' : /* length */
39 if(!sscanf(optarg, "%d", &argval) || (argval < 0))
40 --
41 2.7.5