git @ Cat's Eye Technologies stringie / ab24460
Address https://github.com/catseye/Dipple/issues/2 . Chris Pressey 5 years ago
1 changed file(s) with 7 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
11 * stringie.c -- a brain-freezingly pedantic implementation of Underload in C
22 * (with all the limitations that that implies)
33 * Chris Pressey, September 2010
4 * Bug fix, August 2017: avoid memory overrun in (). Thanks to @stasoid for finding and suggesting fix.
45 * This work is in the public domain.
56 */
67
132133 {
133134 int level = 0;
134135 int j = 0;
135 char *t = malloc(256);
136 int size = 256;
137 char *t = malloc(size);
136138
137139 i++;
138140 level++;
144146 if (level > 0) {
145147 t[j] = program[i];
146148 j++;
149 if (j >= size) {
150 size *= 2;
151 t = realloc(t, size);
152 }
147153 }
148154 i++;
149155 }