Fix searching of ']'
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 31 Mar 2011 22:50:43 +0000 (00:50 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 7 Apr 2011 21:08:21 +0000 (23:08 +0200)
citadel/modules/network/serv_network.c

index 376e3fda3b2f29f9097067da120e1439003f1262..1259ae4676053e0d1a05a23416b28faff9fc74b7 100644 (file)
@@ -717,17 +717,17 @@ void network_spool_msg(long msgnum, void *userdata) {
                                msg->cm_fields['U'] = strdup("(no subject)");
                        }
                        
-                       len = strlen(msg->cm_fields['U']);
-                       pCh = strstr(msg->cm_fields['U'], CC->room.QRname);
+                       len  = strlen(msg->cm_fields['U']);
+                       rlen = strlen(CC->room.QRname);
+                       pCh  = strstr(msg->cm_fields['U'], CC->room.QRname);
                        if ((pCh == NULL) ||
-                           (*(pCh + len) != ']') ||
+                           (*(pCh + rlen) != ']') ||
                            (pCh == msg->cm_fields['U']) ||
                            (*(pCh - 1) != '[')
                                )
                        {
                                char *pBuff;
 
-                               rlen = strlen(CC->room.QRname);
                                rlen += len + 4;
                                pBuff = malloc (rlen * sizeof(char));