From c7cefb1c0558dcbe6648aef5ec915a1155d9ce93 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 10 Aug 2013 15:59:04 +0000 Subject: [PATCH] Don't look beyond the end of a cparse format if it ends with % or $. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@310 13b04d17-f746-0410-82c6-800466cd88b0 --- source/misc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/misc.c b/source/misc.c index d16337e..ab99f94 100644 --- a/source/misc.c +++ b/source/misc.c @@ -4626,12 +4626,17 @@ char *timestamp_str = get_string_var(TIMESTAMP_STRING_VAR); char *cs; tmpc++; this_color = BLACK; + if (*tmpc == '\0') + { + *s++ = '%'; + continue; + } if (*tmpc == '%') { *s++ = *tmpc++; continue; } - else if (isdigit((unsigned char)*tmpc)) + if (isdigit((unsigned char)*tmpc)) { char background_mod[] = "01234567"; char *blah = background_mod; @@ -4708,6 +4713,11 @@ char *timestamp_str = get_string_var(TIMESTAMP_STRING_VAR); { char *new_str = NULL; tmpc++; + if (*tmpc == '\0') + { + *s++ = '$'; + continue; + } if (*tmpc == '$') { *s++ = *tmpc++;