]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
MIPS: Yosemite, Emma: Fix off-by-two in arcs_cmdline buffer size check
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Sat, 29 Oct 2011 13:45:56 +0000 (15:45 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 8 Nov 2011 12:35:29 +0000 (12:35 +0000)
Cause is a misplaced bracket.

The code

    strlen(buf+1)

will be two bytes less than

    strlen(buf)+1

The +1 is in this code to reserve space for an additional space character.

[ralf@linux-mips.org: Thomas' original patch fixed the issue only for
 Yosemite but the same bug exists also in Emma.]

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Patchwork: https://patchwork.linux-mips.org/patch/2861/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/emma/common/prom.c
arch/mips/pmc-sierra/yosemite/prom.c

index 708f08761406fe3bfdbd308822f163a2ae7c9822..cae42259d6da9cc49efd4ceb8bccdbad941fe3d0 100644 (file)
@@ -50,7 +50,7 @@ void __init prom_init(void)
 
        /* arg[0] is "g", the rest is boot parameters */
        for (i = 1; i < argc; i++) {
-               if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
+               if (strlen(arcs_cmdline) + strlen(arg[i]) + 1
                    >= sizeof(arcs_cmdline))
                        break;
                strcat(arcs_cmdline, arg[i]);
index cf4c868715acaaba37e9aec317d0224ca5b6d060..dcc926e06fcec573a4478b2359b2218d5ca942cf 100644 (file)
@@ -102,7 +102,7 @@ void __init prom_init(void)
 
        /* Get the boot parameters */
        for (i = 1; i < argc; i++) {
-               if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >=
+               if (strlen(arcs_cmdline) + strlen(arg[i]) + 1 >=
                    sizeof(arcs_cmdline))
                        break;