From 8cf55d9e495a62c03287670c301d19644ed95f98 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Tue, 15 Jan 2008 12:00:53 +1100 Subject: [PATCH] Avoid referencing before allocated memory on empty string. r2265 | dcl | 2008-01-15 12:00:53 +1100 (Tue, 15 Jan 2008) | 2 lines --- servlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servlog.c b/servlog.c index 9901eb0d..f839207e 100644 --- a/servlog.c +++ b/servlog.c @@ -333,7 +333,7 @@ static const char* timestamp(void) { fprintf(fLogFile,"%s: <<>>\n", timestamp()); fprintf(fLogFile,"%s: ", timestamp()); fprintf(fLogFile,"%s", pText); - if (pText[text_len - 1] != '\n') + if (text_len < 1 || pText[text_len - 1] != '\n') fprintf(fLogFile,"\n"); fflush(fLogFile); iLineCount++;