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

index a5492eb69ed74b1eed4537d6fc4c8fba6b06c3c9..e0cc3280ba040a0c4f397c142339ab6721524a74 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));