aboutsummaryrefslogtreecommitdiff
path: root/src/storycode.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-08-18 15:17:10 +0200
committerThomas White <taw@bitwiz.org.uk>2013-08-18 15:17:10 +0200
commit2482923ebcecf00be8cf35fda53c2195c04fde97 (patch)
tree287c682d9f259d5fa6ee55cb7d02903dbc78a0d1 /src/storycode.c
parent0894ace4ab8b8571ee0544cc7bb3e4607ae20c63 (diff)
Fix string handling bugs
Diffstat (limited to 'src/storycode.c')
-rw-r--r--src/storycode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/storycode.c b/src/storycode.c
index b78f946..66bed60 100644
--- a/src/storycode.c
+++ b/src/storycode.c
@@ -329,7 +329,12 @@ SCBlockList *sc_find_blocks(const char *sc, const char *blockname)
} while ( i<len );
- if ( (blockname == NULL) && (j > 1) ) {
+ /* Add final block, if it exists */
+ if ( (blockname == NULL) && (j > 0) ) {
+
+ /* Leftover buffer is empty? */
+ if ( (j==1) && (tbuf[0]=='\0') ) return bl;
+
tbuf[j] = '\0';
if ( sc_block_list_add(bl, start, NULL, NULL, tbuf) )
{