From c8e2a35763624463d1006a83ab0125603813d239 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sat, 4 Oct 2008 12:43:40 -0500 Subject: [PATCH] fixed an off-by-one error The loop can start at length-1 since we know that the last character in the buffer is a null. Thanks again to Chris Brannon for finding this. --- softsynth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/softsynth.c b/softsynth.c index 6ea5b7b..f42dc08 100644 --- a/softsynth.c +++ b/softsynth.c @@ -163,7 +163,8 @@ void main_loop(struct synth_t *s) break; } *(buf + length) = 0; - for (i = length; i >= 0; i--) + /* *(buf+length) is not 0x18 */ + for (i = length - 1; i >= 0; i--) if (*(buf + i) == 0x18) { /* synth flush char. */ queue_clear(); stop_speech();