X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=cmd%2Fitest.c;h=70db04a04f239e917e5f867a41804b965d62fd89;hb=ed286bc80e9d237dd1732ced037427e7d9a277a0;hp=60626c7fe9c3d983d247aeee6f89b76548a189b5;hpb=dafd64888c21abc43edbe7634b8edaacf9e2fe5c;p=people%2Fms%2Fu-boot.git diff --git a/cmd/itest.c b/cmd/itest.c index 60626c7fe9..70db04a04f 100644 --- a/cmd/itest.c +++ b/cmd/itest.c @@ -80,7 +80,8 @@ static long evalexp(char *s, int w) l = simple_strtoul(s, NULL, 16); } - return l & ((1UL << (w * 8)) - 1); + /* avoid overflow on mask calculus */ + return (w >= sizeof(long)) ? l : (l & ((1UL << (w * 8)) - 1)); } static char * evalstr(char *s) @@ -100,7 +101,7 @@ static char * evalstr(char *s) i++; } s[i] = 0; - return getenv((const char *)&s[2]); + return env_get((const char *)&s[2]); } else { return s; }