ref: ee67552c4bbe674461e7db7b87ceef0a742aeac7
parent: d0bde76422762967107003433de7ddf022083410
author: cinap_lenrek <[email protected]>
date: Thu Jul 11 15:01:03 EDT 2013
cc: fix include array overflow handling
--- a/sys/src/cmd/cc/lex.c
+++ b/sys/src/cmd/cc/lex.c
@@ -1535,12 +1535,12 @@
if(strcmp(p, include[i]) == 0)
break;
- if(i >= ninclude)
+ if(i >= ninclude){
+ if(ninclude >= nelem(include)) {
+ diag(Z, "ninclude too small %d", nelem(include));
+ exits("ninclude");
+ }
include[ninclude++] = p;
-
- if(ninclude > nelem(include)) {
- diag(Z, "ninclude too small %d", nelem(include));
- exits("ninclude");
}
if(e == 0)