add some bounds, for a subsequent commit:

• all writers of exstat ensure the value is in [0; 0xFF]
• all readers of exstat AND it with 0xFF (not strictly needed thus)
• trap_exstat is “safe”, i.e. always either -1 or [0; 0xFF]
This commit is contained in:
tg
2012-10-21 21:39:06 +00:00
parent bebb2d2254
commit 31f24a4040
6 changed files with 22 additions and 20 deletions

4
var.c
View File

@ -27,7 +27,7 @@
#include <sys/sysctl.h>
#endif
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.153 2012/07/30 21:37:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.154 2012/10/21 21:39:06 tg Exp $");
/*-
* Variables
@ -260,7 +260,7 @@ global(const char *n)
vp->flag &= ~(ISSET|INTEGER);
break;
case '?':
vp->val.i = exstat;
vp->val.i = exstat & 0xFF;
break;
case '#':
vp->val.i = l->argc;