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, 31 Mar 2011 23:03:30 +0000 (01:03 +0200)
citadel/modules/network/serv_network.c

index 767d10baeb6e08a582803ac06b09316af3d4a348..b9476f5bb80920f16dfa6eff88f9d76f497fba34 100644 (file)
@@ -712,17 +712,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));