Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(89)

Delta Between Two Patch Sets: src/cmd/5a/lex.c

Issue 198044: code review 198044: Avoid overflow of include and define buffers in 5a/6a/8... (Closed)
Left Patch Set: Created 15 years, 1 month ago
Right Patch Set: code review 198044: Avoid overflow of include and define buffers in 5a/6a/8... Created 15 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/5a/a.h ('k') | src/cmd/6a/a.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Inferno utils/5a/lex.c 1 // Inferno utils/5a/lex.c
2 // http://code.google.com/p/inferno-os/source/browse/utils/5a/lex.c 2 // http://code.google.com/p/inferno-os/source/browse/utils/5a/lex.c
3 // 3 //
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
6 // Portions Copyright © 1997-1999 Vita Nuova Limited 6 // Portions Copyright © 1997-1999 Vita Nuova Limited
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov a.com) 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov a.com)
8 // Portions Copyright © 2004,2006 Bruce Ellis 8 // Portions Copyright © 2004,2006 Bruce Ellis
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void 52 void
53 main(int argc, char *argv[]) 53 main(int argc, char *argv[])
54 { 54 {
55 char *p; 55 char *p;
56 int nout, nproc, i, c; 56 int nout, nproc, i, c;
57 57
58 thechar = '5'; 58 thechar = '5';
59 thestring = "arm"; 59 thestring = "arm";
60 60
61 ensuresymb(NSYMB); 61 ensuresymb(NSYMB);
62 Dlist = alloc(sizeof(char *));
63 include = alloc(sizeof(char *));
64 memset(debug, 0, sizeof(debug)); 62 memset(debug, 0, sizeof(debug));
65 cinit(); 63 cinit();
66 outfile = 0; 64 outfile = 0;
67 » include[ninclude++] = "."; 65 » setinclude(".");
68 ARGBEGIN { 66 ARGBEGIN {
69 default: 67 default:
70 c = ARGC(); 68 c = ARGC();
71 if(c >= 0 || c < sizeof(debug)) 69 if(c >= 0 || c < sizeof(debug))
72 debug[c] = 1; 70 debug[c] = 1;
73 break; 71 break;
74 72
75 case 'o': 73 case 'o':
76 outfile = ARGF(); 74 outfile = ARGF();
77 break; 75 break;
78 76
79 case 'D': 77 case 'D':
80 p = ARGF(); 78 p = ARGF();
81 if(p) { 79 if(p) {
82 » » » Dlist = allocn(Dlist, nDlist*sizeof(char *), sizeof(char *)); 80 » » » if (nDlist%8 == 0)·
81 » » » » Dlist = allocn(Dlist, nDlist*sizeof(char *),
82 » » » » » 8*sizeof(char *));
83 Dlist[nDlist++] = p; 83 Dlist[nDlist++] = p;
84 } 84 }
85 break; 85 break;
86 86
87 case 'I': 87 case 'I':
88 p = ARGF(); 88 p = ARGF();
89 setinclude(p); 89 setinclude(p);
90 break; 90 break;
91 case 't': 91 case 't':
92 thechar = 't'; 92 thechar = 't';
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 Bputc(&obuf, h->line>>8); 738 Bputc(&obuf, h->line>>8);
739 Bputc(&obuf, h->line>>16); 739 Bputc(&obuf, h->line>>16);
740 Bputc(&obuf, h->line>>24); 740 Bputc(&obuf, h->line>>24);
741 zaddr(&nullgen, 0); 741 zaddr(&nullgen, 0);
742 zaddr(&g, 0); 742 zaddr(&g, 0);
743 } 743 }
744 } 744 }
745 745
746 #include "../cc/lexbody" 746 #include "../cc/lexbody"
747 #include "../cc/macbody" 747 #include "../cc/macbody"
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b