translate: fixes
[ia32rtools.git] / tools / protoparse.h
index 7b449be..b17f218 100644 (file)
@@ -33,7 +33,7 @@ struct parsed_proto {
                struct parsed_type ret_type;
                struct parsed_type type;
        };
-       struct parsed_proto_arg arg[16];
+       struct parsed_proto_arg arg[32];
        int argc;
        int argc_stack;
        int argc_reg;
@@ -641,6 +641,12 @@ static int parse_protostr(char *protostr, struct parsed_proto *pp)
                        return -1;
                }
 
+               if (xarg >= ARRAY_SIZE(pp->arg)) {
+                       printf("%s:%d:%zd: too many args\n",
+                               hdrfn, hdrfline, (p - protostr) + 1);
+                       return -1;
+               }
+
                arg = &pp->arg[xarg];
                xarg++;