From e3c328198780bcb0c2ebefed3f3263e85d37888e Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 14 Feb 2002 17:21:13 +0000
Subject: [PATCH] Fixed potential buffer overflow in stripping of FidoNet
 kludge lines.

---
 src/sbbs3/writemsg.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 20102172c2..86a07336c3 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -385,7 +385,10 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
 		/* Strip FidoNet Kludge Lines? */
 		if(buf[l]==1 && useron.xedit
 			&& cfg.xedit[useron.xedit-1]->misc&STRIPKLUDGE) {
-			while(buf[l]!=LF) l++;
+			while(buf[l] && buf[l]!=LF) 
+				l++;
+			if(buf[l]==0)
+				break;
 			continue;
 		}
 		if(!(mode&(WM_EMAIL|WM_NETMAIL))
-- 
GitLab