]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cc: fix typo leading to index out of range.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Sun, 24 Mar 2013 10:38:57 +0000 (11:38 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Sun, 24 Mar 2013 10:38:57 +0000 (11:38 +0100)
Detected by GCC static analysis.

Fixes #5117.

R=golang-dev, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7665047

src/cmd/cc/funct.c

index 05715198715bd2e754e919d8fa7e73bb241477d7..7921277b42978c7e525cf4c641b0a6be6fe09c38 100644 (file)
@@ -269,7 +269,7 @@ dclfunct(Type *t, Sym *s)
                goto bad;
 
        f = alloc(sizeof(*f));
-       for(o=0; o<sizeof(f->sym); o++)
+       for(o=0; o<nelem(f->sym); o++)
                f->sym[o] = S;
 
        t->funct = f;