diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-08 09:39:29 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:32 -0700 |
| commit | 30fbaa8a02f8c726a6faf1be1e346c038f929dfb (patch) | |
| tree | 7fe7b186183264554ace5b905f449210d992246f | |
| parent | a17b6c494fd8f2b9aae53b49bd462c984716c772 (diff) | |
| download | sparse-dev-30fbaa8a02f8c726a6faf1be1e346c038f929dfb.tar.gz | |
Handle bad strings gracefully.
We should never see a TOKEN_STRING of size 0, since
we always add the final '\0' to the string. But bugs
happen, and we'd rather see the problem than a SIGSEGV.
| -rw-r--r-- | tokenize.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -87,6 +87,8 @@ const char *show_string(const struct string *string) char *ptr; int i; + if (!string->length) + return "<bad_string>"; ptr = buffer; *ptr++ = '"'; for (i = 0; i < string->length-1; i++) { |
