Fix out of array bounds errors with -O3
When compiling with -O3 gcc seems to be a lot stricter on its checks for index out of bounds error. Change-Id: I5a63e1db6aa2375223ff13c6352643a9804fa93d
This commit is contained in:
parent
374af94b2b
commit
ffba9c2def
2 changed files with 4 additions and 2 deletions
|
@ -118,7 +118,8 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin,
|
|||
cc.elements = 1;
|
||||
np = sp->nsp;
|
||||
if (np) {
|
||||
while (np && cc.elements <=
|
||||
/* MINIX: off-by one error, has to be strictly less than. */
|
||||
while (np && cc.elements <
|
||||
CURSES_CCHAR_MAX) {
|
||||
cc.vals[cc.elements++] = np->ch;
|
||||
np = np->next;
|
||||
|
|
|
@ -454,7 +454,8 @@ parsedev(char *arg)
|
|||
if (*ep != '\0')
|
||||
mtree_err("invalid number `%s'",
|
||||
p);
|
||||
if (argc > MAX_PACK_ARGS)
|
||||
/* MINIX: 03 warns for above array bounds*/
|
||||
if (argc >= MAX_PACK_ARGS)
|
||||
mtree_err("too many arguments");
|
||||
}
|
||||
if (argc < 2)
|
||||
|
|
Loading…
Reference in a new issue