Fix off-by-two in arcs_cmdline buffer size check
PATCH 1/1 Fix off-by-two in arcs_cmdline buffer size check
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.
Signed-off-by Thomas Jarosch <[email protected]>
--- arch/mips/pmc-sierra/yosemite/prom.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mips/pmc-sierra/yosemite/prom.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.6.4
Ralf Baechle
AppliedQuoted 11 lines · Thomas Jarosch
Cause is a misplaced bracket.
The code
strlen(buf+1)will be two bytes less than
strlen(buf)+1The +1 is in this code to reserve space for an additional space character.
Thanks, applied.
The same buggy code just formatted slightly differently also exists in Emma. I added the Emma fix to the patch and applied it.
Thanks!
Ralf