Unified · Split
| @@ -753,7 +753,7 @@ ST_FUNC void tcc_open_bf(TCCState *s1, const char *filename, int initlen) · 752 unmodified lines | |||
| 753 | BufferedFile *bf; | 753 | BufferedFile *bf; |
| 754 | int buflen = initlen ? initlen : IO_BUF_SIZE; | 754 | int buflen = initlen ? initlen : IO_BUF_SIZE; |
| 755 | 755 | ||
| 756 | bf = tcc_mallocz(sizeof(BufferedFile) + buflen); | 756 | bf = tcc_mallocz(sizeof(BufferedFile) + buflen + 1); |
| 757 | bf->buf_ptr = bf->buffer; | 757 | bf->buf_ptr = bf->buffer; |
| 758 | bf->buf_end = bf->buffer + initlen; | 758 | bf->buf_end = bf->buffer + initlen; |
| 759 | bf->buf_end[0] = CH_EOB; /* put eob symbol */ | 759 | bf->buf_end[0] = CH_EOB; /* put eob symbol */ |
| @@ -631,7 +631,7 @@ typedef struct BufferedFile { · 630 unmodified lines | |||
| 631 | char filename[1024]; /* filename */ | 631 | char filename[1024]; /* filename */ |
| 632 | char *true_filename; /* filename not modified by # line directive */ | 632 | char *true_filename; /* filename not modified by # line directive */ |
| 633 | unsigned char unget[4]; | 633 | unsigned char unget[4]; |
| 634 | unsigned char buffer[1]; /* extra size for CH_EOB char */ | 634 | unsigned char buffer[]; /* + extra byte for CH_EOB char */ |
| 635 | } BufferedFile; | 635 | } BufferedFile; |
| 636 | 636 | ||
| 637 | #define CH_EOB '\\' /* end of buffer or '\0' char in file */ | 637 | #define CH_EOB '\\' /* end of buffer or '\0' char in file */ |