From 3b1f89288e55293ee9c7d0f6bf6423c9239e612a Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 20 Aug 2003 09:59:59 +0000 Subject: [PATCH] savemsg() now truncates white-space off the end of the message text, thus the stored message text may be less than the string length of msgbuf. --- src/sbbs3/postmsg.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp index 8c2b409c55..0903190bd4 100644 --- a/src/sbbs3/postmsg.cpp +++ b/src/sbbs3/postmsg.cpp @@ -465,9 +465,13 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, char* msg } length=strlen(msgbuf); + /* Remove white-space from end of message text */ + while(length && (uchar)msgbuf[length-1]<=' ') + length--; + /* Calculate CRC-32 of message text (before encoding, if any) */ if(smb->status.max_crcs) { - for(l=0;msgbuf[l];l++) + for(l=0;l<length;l++) crc=ucrc32(msgbuf[l],crc); crc=~crc; } -- GitLab