diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2014-03-27 22:59:05 +0800 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2014-03-29 14:46:26 +0800 |
| commit | 9a6ee577f6165dccfde424732bfc6f16f1e2811b (patch) | |
| tree | 01cc2ef73b2fb706f6b550106bf3f61388ff1575 /tccpp.c | |
| parent | 5c233f2cf37a7bbf00b12df606f876c7275ef98f (diff) | |
| download | tinycc-9a6ee577f6165dccfde424732bfc6f16f1e2811b.tar.gz tinycc-9a6ee577f6165dccfde424732bfc6f16f1e2811b.tar.bz2 | |
Make get_tok_str support NULL as second param.
As was pointed out on tinycc-devel, many uses of get_tok_str gives as
second parameter the value NULL. However, that pointer was
unconditionally dereferenced in get_tok_ptr. This commit explicitely add
support for thas case.
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -255,9 +255,15 @@ ST_FUNC char *get_tok_str(int v, CValue *cv) static char buf[STRING_MAX_SIZE + 1]; static CString cstr_buf; CString *cstr; + CValue cval; char *p; int i, len; + if (!cv) { + cval.ull = 0; + cv = &cval; + } + /* NOTE: to go faster, we give a fixed buffer for small strings */ cstr_reset(&cstr_buf); cstr_buf.data = buf; |
